6 months ago

trying to pass url variable but i got this NotFoundHttpException

Posted 6 months ago by Lestah

here's my listing.blade.php

 @foreach($categories as $cat)
                    <li class=""><a href="{{ url('/products/'.$cat->url ) }}">{{ $cat->name }}</a></li>    

here's my controller

public function products($url = null)
        $categories = Category::where('parent_id', 0)->get();
        $productsAll = Product::where('url', $url)->get();

        return view('products.listing')->with(compact('categories','productsAll'));   

here's my route

Route::get('/products/{url}','[email protected]');

Im just trying to get this output


whenever i click the href

I'm just getting this with the error


reason why i get to the error page NotFoundHttpException

not getting the url mobile that i pass what could be wrong?

Please sign in or create an account to participate in this conversation.