Closed MrLenh closed 8 years ago
Can you provide some more info like have you added the Service Provider on your config/app.php file and installed the package correctly or not?
Cart facade is not working in laravel 5.2
I can't also find out how to publish that default migration built into ShoppingcartServiceProvider and config/Cart.php
I can't reproduce this, tried several times, but I experience no such problems.
laravel new shop-test
composer require gloudemans/shoppingcart
Add the service provider to the providers
array in config/app.php
:
Gloudemans\Shoppingcart\ShoppingcartServiceProvider::class,
Add the facade alias to the aliases
array in config/app.php
:
'Cart' => Gloudemans\Shoppingcart\Facades\Cart::class,
And in the controller I use the Cart facade use Cart;
And next I can use the facade perfectly fine.
Concerning the migration, indeed documentation is not up to date yet, but you can add it by running this artisan command:
artisan vendor:publish --provider="Gloudemans\Shoppingcart\ShoppingcartServiceProvider"
its working perfectly its was our projects that was using old cached configuration
Hello, After apply LaravelShoppingcart, i am facing the bug: Class 'Cart' not found I used laravel 5.2. my function: use App\Http\Requests; use Illuminate\Http\Request; use DB; use Mail; use Cart;
public function AddToCart($id) { $product_buy = DB::table('Products')->where('id',$id)->first(); Cart::add(['id'=>$id, 'name'=>$product_buy->name,'qty'=>1,'price'=>$product_buy->price,'option'=>['image'=>$product_buy->image]]); return redirect()->route('ShowCart'); } public function ShowCart() {
$content = Cart::content(); return view('interface.cart', compact('content')); }
Could you give me some advices about this?