alphabay84

alphabay84

Member Since 8 Months Ago

Experience Points 210
Experience Level 1

4,790 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 0
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

06 Dec
7 months ago

alphabay84 left a reply on How To Retain Cart Or Form Data On Page Refresh

@FREZNO - thanks a lot i understand it better now

05 Dec
7 months ago

alphabay84 left a reply on How To Retain Cart Or Form Data On Page Refresh

@FREZNO - thanks for reply, I have read the doc, still do not understand, session()->push('cart', $data); here does it mean cart is the id for shopping cart table or form which for in this case is "checkproduct", then $data would be the products. if so how and where should i put this, apologies if my question is not right. Thanks

alphabay84 started a new conversation How To Retain Cart Or Form Data On Page Refresh

hello Please i need help with keeping data or items in cart after page refresh or reload. I in my app after adding products to cart, the products in cart empties when page is refreshed, what i really need to do is to use cookie, web storage, or session storage. I have searched for how to do this but could find my way as i really have no clue about this. I have the table where the products are added below


    <table class="table-inner table-scroll">
        <thead>
        <tr>
            <th>Название</th>
            <th>Кол.</th>
            <th>Цена закупки</th>
            <th>Сумма</th>
            <th class="icons-col text-center"></th>
        </tr>
        </thead>

<tbody id="checkProducts" class="scrollbar lines-control">
{{-- Enter here the products --}}
</tbody>
</table>

the products are added to tbody id="checkProducts" i need return the products already in the cart on page refresh, i already have a submit button that clear products on submit. I can show full code if required, thanks

30 Nov
7 months ago

alphabay84 left a reply on Laravel Fill Form On Autocomplete Select

@VAJID - thanks again, to be clear the getSelectedProduct($id) function should be inside the autocomplete function or on its own, cos as i understand if its on its own then will need route. Sorry if the question is not place right, am just learning.

alphabay84 left a reply on Laravel Fill Form On Autocomplete Select

@VAJID - @vajid Thanks for answer, i updated controller, for JS i do not understand how do i append on autocomplete click, cos when search done there are list of matching product then when a product is selected how do i append input values in the form. Please can do example for one input i.e name, price or quantity. Thanks

alphabay84 started a new conversation Laravel Fill Form On Autocomplete Select

Hello all Please i need help with auto complete on select to fill form, the autocomplete is working and getting products from the database but i need to fill input form with product name, price etc. Please i need help with this, I have included below the following

<div class="container-fluid p-0 ">
    <label for="productName" class="sr-only">Поиск:</label>
    <input type="text" class="form-control input-sm rounded-0 border-0 pt-2" id="productName" placeholder="Поиск: Название товара">
            </div>```
for search product (this works ok)

Форма редактирования вносимых данных о товаре

<label for="product-name">Название товара:</label>
<input type="text" class="form-control rounded-0 border-left-0" id="product-name" disabled>

<label for="product-quantity">Количество:</label>
<input type="number" class="form-control rounded-0 border-left-0 e-invalid" id="product-quantity" min="0" step="0.001" pattern="\d{1,2}[.|,]\d{3}$" title="Введите правильно значение!"  max="1000000">
</div>
Цена закупки:

Цена продажи:

Сохранить в чек ```this is the form where i want to fill on autocomplete select
        $(document).ready(function() {
            src = "{{ route('agent.searchajax') }}";
            $("#productName").autocomplete({
                source: function(request, response) {
                    $.ajax({
                        url: src,
                        dataType: "json",
                        data: {
                            term : request.term
                        },
                        success: function(data) {
                            response(data);

                        }
                    });
                },
                minLength: 1,

            });
        });
</script>``` this is the JS for the auto complete this also work

public function autoComplete(Request $request) {
    $query = $request->get('term','');

    $products=Product::where('name','LIKE','%'.$query.'%')->get();

    $result=array();
    foreach ($products as $product) {
        $result[]=array('value'=>$product->name,'id'=>$product->id);
    }
    if(count($result))
        return $result;
    else
        return ['value'=>'продукт не найден','id'=>''];
}

Route::get('searchajax',array('as'=>'searchajax','uses'=>'[email protected]'));


Please what i want to achieve is to fill the form with product details on autocomplete select, I have tried some tutorials and script but no success yet, thanks in advance
07 Nov
8 months ago

alphabay84 left a reply on Laravel Live Search Not Data Display On Blade

Thanks, done it, works great.

05 Nov
8 months ago

alphabay84 started a new conversation Laravel Live Search Not Data Display On Blade

Hello Please I got code from weblesson "Live search in Laravel using AJAX" which i have edited, I am kind of lost cos i have little experience, there is no error when i run view page but on saerching for product no data is returned. Below is the input for search product

<input type="text" name="search" id="search" class="form-control" placeholder=""/>

I have the function below in my controller

    function for product autosearch     
    public function action(Request $request)
    {
     if($request->ajax())
     {
      $output = '';
      $query = $request->get('query');
      if($query != '')
      {
       $products = Product::query()
            ->without([
                'batches',
                'category',
                'measure',
                'manufacturer'
            ])
            ->select([
                'products.id',
                'products.name',
                'products.barcode',
                'products.price',
                'measures.name as measure',
                'manufacturers.name as manufacturer'
            ])
            ->join('measures', 'products.measure_id', '=', 'measures.id')
            ->join('manufacturers', 'products.manufacturer_id', '=', 'manufacturers.id')
            ->where([
              ['products.name', 'like', "%{$request->data}%"],
                                ['products.barcode', 'like', "%{$request->data}%"],
                        ])
            ->get();
     
      }
      else
      {
         
return view('agent');
                     
      }
      $total_row = $products->count();
      if($total_row > 0)
      {
       foreach($products as $row)
       {
        $output = $products;
       }
      }
      else
      {
       $output = '
       <tr>
        <td align="center" colspan="5">No Data Found</td>
       </tr>
       ';
      }
      $products = array(
       'table_data'  => $output,
       'total_data'  => $total_row
      );

      echo json_encode($products);
     }
    }

for veiw i have a table with table with this is where the search result should display. then before closing of section I have the JS below

<script>
$(document).ready(function(){

fetch_product_data();

function fetch_product_data(query = '')
{
$.ajax({
url:"{{ route('agent.action') }}",
method:'GET',
data:{query:query},
dataType:'json',
success:function(data)
{
$('tbody').html(data.table_data);
$('#total_records').text(data.total_data);
}
})
}

$(document).on('keyup', '#search', function(){
var query = $(this).val();
fetch_product_data(query);
});
});
</script>   

Please can anyone edit function in controller to show product result, I have tried tutorial and videos but no success on this, thanks in advance