Cyber Monday! Get 25% off for as long as you keep your subscription. New subscribers only.

Osho

Osho

Member Since 4 Weeks Ago

Experience Points
190
Total
Experience

4,810 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 your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

Level 1
190 XP
Nov
01
4 weeks ago
Activity icon

Replied to 500 Internal Server Error

[2020-11-02 00:31:13] local.ERROR: Undefined offset: 0 {"userId":5,"exception":"[object] (ErrorException(code: 0): Undefined offset: 0 at /Applications/XAMPP/xamppfiles/htdocs/afiaprime/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1362)
[stacktrace]

This is the error I'm getting now

Oct
31
4 weeks ago
Activity icon

Replied to 500 Internal Server Error

Thanks, I'm getting this error now

[2020-10-31 22:24:02] local.ERROR: Undefined offset: 0 {"userId":5,"exception":"[object] (ErrorException(code: 0): Undefined offset: 0 at /Applications/XAMPP/xamppfiles/htdocs/afiaprime/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1362)
[stacktrace]
Activity icon

Replied to When I Dd($request->cat_id) I Get This "1min_price=max_price=search="

public function show($id, $slug, Request $request)
    {
        $cat = $id;
        // dd($cat);
        $catByUser = $cat;
        $catname = ProductCategory::find($slug);
        $subcategory = SubCategory::with(['productCategory'])->orderBy('name')->get();
        $data = Product::where('categories_id', $cat)->get();
        // dd($catname);
        $cart = User::findorfail(auth()->user()->id)->cart;
        $user = auth()->user()->id;
        $messages = User::findorfail($user)->latestmessaging->count();
        // dd($category);
        return view('frontEnd.product-category', compact('data', 'catname', 'catByUser', 'subcategory', 'cart', 'messages'));
    }
Activity icon

Started a new Conversation When I Dd($request->cat_id) I Get This "1min_price=max_price=search="

I am trying to get request data from my inputsID but it's rendering my data the wrong way, how do I fix this? ````"1min_price=max_price=search="what I am getting on dd($request->cat_id) instead of just the value for$cat_id```.

Inputs

<div style="display: inline-block; margin-top:12px; text-align: center;">
                    <input type="text" id="catID" value="{{$catByUser}}" hidden/>
                    <input type="number" id="minpriceID" min="0" class="form-control" style="margin: inherit;" placeholder="Min Price">
                    <input type="number" id="maxpriceID" min="0" class="form-control" style="margin: inherit;" placeholder="Max Price">
                    <input type="text" id="search" class="form-control" style="margin: inherit;" placeholder="search product by name">
                    <div style="margin-top:inherit;">
                        <button class="login-btn form-control" id="findBtn" style="margin: inherit; border-left: inset;"> <span class="fas fa-filter"></span> Filter</button>
                    </div>
                </div>
<script>
$(document).ready(function(){
  $("#findBtn").click(function(){
    var cat = $("#catID").val();
    var minprice = $('#minpriceID').val();
    var maxprice = $('#maxpriceID').val();
    var search = $('#search').val();
    
    $.ajax({
      type: 'get',
      dataType: 'html',
      url: '{{url('/productsCat')}}',
      data: 'cat_id=' + cat + 'min_price=' + minprice + 'max_price=' + maxprice + 'search=' + search,
      success:function(response){
        console.log(response);
        $("#productData").html(response);
      }
    });
  });
});
</script>
Oct
30
1 month ago
Activity icon

Replied to I Am Getting Error While Using Chatify Package

let's see your route and your controller

Activity icon

Replied to 500 Internal Server Error

I got this

"2min_price=90max_price=100search=another"
null
null
null

I think the first value 2min_price=90max_price=100search=another is the cat_id. it's mean't to be just 2 not the result it is giving. all the results are combined in cat_id. what do I do?

Activity icon

Replied to 500 Internal Server Error

Applied but still getting the same error in error log

public function productsCat(Request $request){
        
        $cat_id = $request->cat_id;
        // dd(count($request->price));
        $pricemax= $request->max_price;
        $pricemin= $request->min_price;
        $search= $request->search;

        // price are array
        if($cat_id!="" && $pricemax!="0" && $search!=""){
        //   $price = explode("-",$request->price);
        $pricemax= $request->max_price;
        $pricemin= $request->min_price;
        $search= $request->search;
 
           $start = $pricemin;
           $end = $pricemax;
 
           //echo "both are selected";
           $data = DB::table('products')
           ->join('product_categories','product_categories.id', '=', 'products.categories_id')
           ->where('products.categories_id',$cat_id)
           ->where('products.price', ">=", $start)
           ->where('products.price', "<=", $end)
           ->where('products.p_name',$search)
           ->get();
 
        }
        else if($pricemax!="0"){
        //   $price = explode("-",$request->price);
        $pricemax= $request->max_price;
        $pricemin= $request->min_price;

          $start = $pricemin;
          $end = $pricemax;
 
          //echo "price is selected";
          $data = DB::table('products')
          ->join('product_categories','product_categories.id', '=', 'products.categories_id')
          ->where('products.price', ">=", $start)
          ->where('products.price', "<=", $end)
          ->get();
 
        }
        else if($cat_id!=""){
          //echo "cat is selected";
          $data = DB::table('products')
          ->join('product_categories','product_categories.id', '=', 'products.categories_id')
          ->where('products.categories_id',$cat_id)
          ->get();
        }
        else{
          //echo "nothing is slected";
          return "<h1 align='center'>Please select atleast one filter from dropdown</h1>";
 
        }
 
        if(!$data){
            echo "<h1 align='center'>no products found under this Category</h1>";
          }else{
          return view('frontEnd.product-category',[
            'data' => $data, 'catByUser' => $data[0]->cat_name
          ]);
      }
 
     }
Activity icon

Replied to 500 Internal Server Error

I applied it for all three

Activity icon

Replied to 500 Internal Server Error

I am trying to filter from my request submitted

my blade

<div class="contact-container" style="align-items: flex-start;">
        <div class="form-container lcontact-form" style="width: 100%;">
            <h3 style="margin-bottom: revert; margin-top:12px;">Filter Category</h3>
                <div style="display: inline-block; margin-top:12px; text-align: center;">
                    <input type="text" id="catID" value="{{$catByUser}}" hidden/>
                    <input type="number" id="minpriceID" min="0" class="form-control" style="margin: inherit;" placeholder="Min Price">
                    <input type="number" id="maxpriceID" min="0" class="form-control" style="margin: inherit;" placeholder="Max Price">
                    <input type="text" id="search" class="form-control" style="margin: inherit;" placeholder="search product by name">
                    <div style="margin-top:inherit;">
                        <button class="login-btn form-control" id="findBtn" style="margin: inherit; border-left: inset;"> <span class="fas fa-filter"></span> Filter</button>
                    </div>
                </div>
        </div>
        <div class="gender-clothing">
            <div class="title-row">
                <div class="main-title">
                <h3 style="font-size: xx-large;">{{$catname->name}} Category</h3>
                </div>
            </div>
            <div class="cloth-row" id="productData">
            @if(count($data)=="0")
                <h1 align="center" style="margin-top:20px">
                    No products found under
                <b style="color:red">{{$catByUser}} </b>
                    Category
                </h1>
            @elseif (count($data)!="0")
                    @foreach($data as $p)
                        <div class="cloth">
                            <div class="card">
                            <img src="/products/large/{{$p->image}}" alt="{{$p->image}}" style="width:100%">
                            <h1 style="margin-top: revert;">{{$p->p_name}}</h1>
                            <br>
                            <p class="price" style="color:#0d6cb3;">NGN {{$p->price}}</p>
                            <br>
                            <p><a href="/product-detail/{{$p->id}}/{{$p->slug}}"><button>Explore</button></a></p>
                            </div>
                        </div>
                    @endforeach
            @endif
            </div>
        </div>
    </div>

<script>
$(document).ready(function(){
  $("#findBtn").click(function(){
    var cat = $("#catID").val();
    var minprice = $('#minpriceID').val();
    var maxprice = $('#maxpriceID').val();
    var search = $('#search').val();
    
    $.ajax({
      type: 'get',
      dataType: 'html',
      url: '{{url('/productsCat')}}',
      data: 'cat_id=' + cat + 'min_price=' + minprice + 'max_price=' + maxprice + 'search=' + search,
      success:function(response){
        console.log(response);
        $("#productData").html(response);
      }
    });
  });
});
</script>

my route

Route::get('/selected-category/{id}/{slug}', '[email protected]')->middleware('auth');
Route::get('selected-category/{id}/{slug}','[email protected]');
Route::get('productsCat','[email protected]');

my controller

public function productsCat(Request $request){
        
        $cat_id = $request->cat_id;
        // dd(count($request->price));
        $pricemax= $request->max_price;
        $pricemin= $request->min_price;
        $search= $request->search;

        // price are array
        if($cat_id!="" && $pricemax!="0" && $search!=""){
        //   $price = explode("-",$request->price);
        $pricemax= $request->max_price;
        $pricemin= $request->min_price;
        $search= $request->search;
 
           $start = $pricemin;
           $end = $pricemax;
 
           //echo "both are selected";
           $data = DB::table('products')
           ->join('product_categories','product_categories.id','products.categories_id')
           ->where('products.categories_id',$cat_id)
           ->where('products.price', ">=", $start)
           ->where('products.price', "<=", $end)
           ->where('products.p_name',$search)
           ->get();
 
        }
        else if($pricemax!="0"){
        //   $price = explode("-",$request->price);
        $pricemax= $request->max_price;
        $pricemin= $request->min_price;

          $start = $pricemin;
          $end = $pricemax;
 
          //echo "price is selected";
          $data = DB::table('products')
          ->join('product_categories','product_categories.id','products.categories_id')
          ->where('products.price', ">=", $start)
          ->where('products.price', "<=", $end)
          ->get();
 
        }
        else if($cat_id!=""){
          //echo "cat is selected";
          $data = DB::table('products')
          ->join('product_categories','product_categories.id','products.categories_id')
          ->where('products.categories_id',$cat_id)
          ->get();
        }
        else{
          //echo "nothing is slected";
          return "<h1 align='center'>Please select atleast one filter from dropdown</h1>";
 
        }
 
        if(!$data){
            echo "<h1 align='center'>no products found under this Category</h1>";
          }else{
          return view('frontEnd.produt-category',[
            'data' => $data, 'catByUser' => $data[0]->cat_name
          ]);
      }
 
     }
Activity icon

Replied to 500 Internal Server Error

[2020-10-30 19:12:09] local.ERROR: Illegal operator and value combination. {"userId":5,"exception":"[object] (InvalidArgumentException(code: 0): Illegal operator and value combination. at /Applications/XAMPP/xamppfiles/htdocs/afiaprime/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:754)
[stacktrace]
Activity icon

Started a new Conversation 500 Internal Server Error

Error Log

[2020-10-30 18:56:53] local.ERROR: Illegal operator and value combination. {"userId":5,"exception":"[object] (InvalidArgumentException(code: 0): Illegal operator and value combination. at /Applications/XAMPP/xamppfiles/htdocs/afiaprime/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php:754)
[stacktrace]

Controller

public function productsCat(Request $request){
        
        $cat_id = $request->cat_id;
        // dd(count($request->price));
        $pricemax= $request->max_price;
        $pricemin= $request->min_price;
        $search= $request->search;

        // price are array
        if($cat_id!="" && $pricemax!="0" && $search!=""){
        //   $price = explode("-",$request->price);
        $pricemax= $request->max_price;
        $pricemin= $request->min_price;
        $search= $request->search;
 
           $start = $pricemin;
           $end = $pricemax;
 
           //echo "both are selected";
           $data = DB::table('products')
           ->join('product_categories','product_categories.id','products.categories_id')
           ->where('products.categories_id',$cat_id)
           ->where('products.price', ">=", $start)
           ->where('products.price', "<=", $end)
           ->where('products.p_name',$search)
           ->get();
 
        }
        else if($pricemax!="0"){
        //   $price = explode("-",$request->price);
        $pricemax= $request->max_price;
        $pricemin= $request->min_price;

          $start = $pricemin;
          $end = $pricemax;
 
          //echo "price is selected";
          $data = DB::table('products')
          ->join('product_categories','product_categories.id','products.categories_id')
          ->where('products.price', ">=", $start)
          ->where('products.price', "<=", $end)
          ->get();
 
        }
        else if($cat_id!=""){
          //echo "cat is selected";
          $data = DB::table('products')
          ->join('product_categories','product_categories.id','products.categories_id')
          ->where('products.categories_id',$cat_id)
          ->get();
        }
        else{
          //echo "nothing is slected";
          return "<h1 align='center'>Please select atleast one filter from dropdown</h1>";
 
        }
 
        if(!$data){
            echo "<h1 align='center'>no products found under this Category</h1>";
          }else{
          return view('frontEnd.produt-category',[
            'data' => $data, 'catByUser' => $data[0]->cat_name
          ]);
      }
 
     }