Crinsane / LaravelShoppingcart

A simple shopping cart implementation for Laravel
MIT License
3.67k stars 1.73k forks source link

[Laravel 5.2] Class 'Cart' not found #133

Closed dasaco closed 8 years ago

dasaco commented 8 years ago

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

dasaco commented 8 years ago

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

lukepolo commented 8 years ago

Did you reference it via \Cart or just Cart.

If you did the later make sure to include it.

use Cart;

dasaco commented 8 years ago

Hello, thank you for your answer

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

MrLenh commented 8 years ago

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

wapnen commented 7 years ago

hello have you found the solution to this problem

eberkund commented 7 years ago

Post your source code, it is definitely working

sampat-rebelute commented 7 years ago

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

DavidPrologo commented 6 years ago

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

fahruroze commented 5 years ago

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

nipun21 commented 4 years ago

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;

bumbummen99 commented 4 years ago

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

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

abdulrehman3725 commented 3 years ago

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

Your problem worked for me.

moizfyaa commented 2 years ago

It's also not helpfull