I want to get some view data using laravel. here is my code:
public function brandsview($cate_url, $brand_url)
{
$brands = Brands::where('url',$brand_url)->first();
$brand_id = $brands->id;
$products = Products::where('brand_id',$brand_id)
->where('status','!=','Hide')
->where('status','Show')
->get();
return view('lokalproductspage.brands')
->with('brands', $brands)
->with('products', $products);
}
I get the error trying to get property 'id' of non-object
. Please help me.