Lestah
6 months ago

is this the right way of doing this

Posted 6 months ago by Lestah
public function products($url = null)
    {
        $categories = Category::where('parent_id', 0)->get();
        $productsAll = Product::where('category_name', $url);

        //echo "<pre>"; print_r($productsAll); die;
        return view('products.listing')->with(compact('categories','productsAll'));
        
    }

i don't get any data on productsAll i just want to get all the products where category name is equal to url


$productsAll = Product::where('category_name', $url);

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