sprintcar78a
sprintcar78a

Reputation: 199

Laravel 5 Models/Classes not found

I'm struggling to use models and classes in Laravel 5 'FatalErrorException' class "name" not found.

Take the User class as standard under the App/ folder, it will only work as $user = App\User::where... or I can go 'use App/User'... Rather than just User::where. How can I get around this back to L4 where it just worked?

Secondly I came to Session::get standard Laravel Class, same error class 'Session' not found.

Unable to find a solution after 4 hours I'm resorting to asking the question... Thanks.

Upvotes: 0

Views: 2087

Answers (2)

odin88
odin88

Reputation: 76

use App\Site;

Site::all();

or

\App\Site::all();

Upvotes: 1

Imtiaz Pabel
Imtiaz Pabel

Reputation: 5443

for laravel 5 you need to use namaspace if you want to use session you need to use that line in top of the class

use Session;

Upvotes: 1

Related Questions