Closed sagarneo11 closed 8 years ago
Did you include the facade ?
hi,
thanks for reply, using laravel 5.2, i am not sure what exactly you mean but,
inside 'aliases' in routes.php i have following 'Cart' => Gloudemans\Shoppingcart\Facades\Cart::class,
and inside 'providers' in routes.php i have following Gloudemans\Shoppingcart\ShoppingcartServiceProvider::class,
Please supply more code to work with. No way for me to debug this. Also, an IDE telling you 'undefined class' doesn't mean the class is undefined... try using the laravel-ide-helper.
What's the code in Front.php line 102?
on line # 102 the code is as below Cart::update($rowId[0], $item->qty + 1);
also please let me know how i can share whole project if possible i will share.
Viewing the exception you posted, it looks to me like the problem isn't the cart, but $rowId
is false and $item
is null
Try checking your code and see what the $rowId
and $item
are like. Problem doesn't seem to have anything to do with the cart.
Below is the error in detail...
how much i know 'use Cart;' is not working. IDE showing error undefined class.
in Front.php line 102 at HandleExceptions->handleError('8', 'Trying to get property of non-object', 'E:\xampp\htdocs\laravel\app\Http\Controllers\Front.php', '102', array('rowId' => false, 'item' => null)) in Front.php line 102 at Front->cart() at call_user_func_array(array(object(Front), 'cart'), array()) in Controller.php line 76 at Controller->callAction('cart', array()) in ControllerDispatcher.php line 146 at ControllerDispatcher->call(object(Front), object(Route), 'cart') in ControllerDispatcher.php line 94 at ControllerDispatcher->Illuminate\Routing{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
Front.php
<?php namespace App\Http\Controllers;
use App\Brand; use App\Category; use App\Product; Use App\User; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Request; use Illuminate\Support\Facades\Redirect; use Illuminate\Support\Facades\Auth; use Cart;