Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mstnorris's avatar

Class 'App\Http\Controllers\Auth' not found

App has been replaced with my app's name.

Has anyone else had this issue?

Whoops, looks like something went wrong.

1/1
FatalErrorException in ArticlesController.php line 57:
Class 'App\Http\Controllers\Auth' not found
in ArticlesController.php line 57
at HandleExceptions->fatalExceptionFromError(array('type' => '1', 'message' => 'Class 'App\Http\Controllers\Auth' not found', 'file' => '/home/vagrant/Code/laravel/my_project/app/Http/Controllers/ArticlesController.php', 'line' => '57')) in HandleExceptions.php line 116
at HandleExceptions->handleShutdown()
0 likes
17 replies
JeffreyWay's avatar
Level 59

Go to ArticlesController and add use Auth at the top.

40 likes
opheliadesign's avatar

@MartinJH be prepared to include a lot of things with the use statement in Laravel 5, such as models and facades.

I use PHP Storm, it can be configured to automatically import classes.

1 like
Michael_Johnson's avatar

I am still having a problem with including the path to the Auth folder. When I include it at the top and try to use Auth:: it still has no idea where this is. Instead of using Auth:: on its own I tried to define it more explicitly in the code using Controllers/Auth:: which seems to work but in that case the method user() cannot be found :-/

reverser's avatar

I solved adding this at the Top of the Controller:

use Illuminate\Support\Facades\Auth;

Hope it helps.

19 likes
ray1618's avatar

Added use Auth to the file fixed also fixed my issue :)

digitalbalance's avatar

I know this comment is 4 years old but you are a lifesaver. Been stuck for like 30 minutes haha

Please or to participate in this conversation.