In my Laravel I'm using this shoppingcart .
When i add one product to my shopping cart i wan to have associate()
with App\Product
Model .
This is my code :
public function store(Request $request)
{
// store product information to Cart
Cart::add($request->id, $request->name, 1, $request->price)
->associate('App\Product');
return redirect(route('cart.index'))->with('success_message','محصول با موفقیت به سبد اضافه شد');
}
But when i want to access model $item->model->id
in view I get this error :
Trying to get property 'id' of non-object (View: C:\xampp\htdocs\digikala\resources\views\cart.blade.php)
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2IKVFQO
via IFTTT
Aucun commentaire:
Enregistrer un commentaire