Laravelshoppingcart: [Laravel 5.2] Class 'Cart' not found

Created on 12 Mar 2016  路  12Comments  路  Source: Crinsane/LaravelShoppingcart

Hello,

Version: Laravel 5.2

I'm getting Class 'Cart' not found, when trying to use it in Controller, that has use Cart in it's header

In config/app.php I have both Provider and Facade

Provider:
Gloudemans\Shoppingcart\ShoppingcartServiceProvider::class,

Facade:
'Cart' => Gloudemans\Shoppingcart\Facades\Cart::class,

In routes I use 'web' middleware correctly.

In composer.json I have

"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2._",
"laravelcollective/html": "5.2._",
"filp/whoops": "^2.0",
"gloudemans/shoppingcart": "~1.3"
},

Any ideas on how to solve this issue?

Thank you

All 12 comments

Also tried various ways of writing facade and provider in app.php, nothing works

Done composer dump-autoload and composer update

Directory exists in vendor folder, it is there

Did you reference it via \Cart or just Cart.

If you did the later make sure to include it.

use Cart;

Hello, thank you for your answer

But I tried this already, doesn't seem to work either

I'm facing this issue too, did you fix it?

hello have you found the solution to this problem

Post your source code, it is definitely working

Hello i am also facing the same issue i.e. Cart not found on server.

I've got the same issue, my friend told me that's the php version 7.0 which must be updated to at least 7.1. But the server's using 7.0

I fix this issue with include on CartController -> use Cart;

I have fixed this issue by adding in config\app.php

Provider:
Gloudemans\Shoppingcart\ShoppingcartServiceProvider::class,

aliases:
'Cart' => Gloudemans\Shoppingcart\Facades\Cart::class,

in app\Http\Controller\Your-Controller-file.php

use Cart;

The package automatically registers the alias. Did you use it as \Cart or Cart?

https://github.com/bumbummen99/LaravelShoppingcart/issues/77

Hello,

Version: Laravel 5.2

I'm getting Class 'Cart' not found, when trying to use it in Controller, that has use Cart in it's header

In config/app.php I have both Provider and Facade

Provider:
Gloudemans\Shoppingcart\ShoppingcartServiceProvider::class,

Facade:
'Cart' => Gloudemans\Shoppingcart\FacadesCart::class,

In routes I use 'web' middleware correctly.

In composer.json I have

"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2._", "laravelcollective/html": "5.2._",
"filp/whoops": "^2.0",
"gloudemans/shoppingcart": "~1.3"
},

Any ideas on how to solve this issue?

Thank you

Your problem worked for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ellgibug picture ellgibug  路  5Comments

nasirkhan picture nasirkhan  路  8Comments

rubelkhan447 picture rubelkhan447  路  6Comments

pelachile picture pelachile  路  8Comments

abdullahkaamil picture abdullahkaamil  路  3Comments