Posted inphp / Laravel / Mysql / Mysqli / Programming

How to fix Class ‘App\Http\Controllers\Auth’ not found

in Class ‘App\Http\Controllers\Auth’ not found Resolve Error for Go to YourCustomController after that add use Auth; at the top on the Controller Page.

Display Error: Class ‘App\Http\Controllers\Auth’ not found -FatalErrorException in LoginController.php

FatalErrorException in LoginController.php line 52: Class ‘App\Http\Controllers\Admin\Auth\Auth’ not found in LoginController.php line 52

Solution for “Class ‘App\Http\Controllers\Auth’ not found”

use Auth; 
// Illuminate\Support\Facades\Auth

//or try it

use Illuminate\Support\Facades\Auth;

Also Read: Html Form Class Not Found In Laravel

‘App\Http\Controllers\Auth\Auth’ not found in Laravel 5.6

step 1: first of all go to Illuminate\Foundation\Exceptions\Handler.php class
step 2: here find unauthenticated method
step 3: and then last update it with source code below

protected function unauthenticated($request, AuthenticationException $exception)
{
    return $request->expectsJson()
                ? response()->json(['message' => $exception->getMessage()], 401)
                : redirect('/');
}

The proper namespace is Illuminate\Support\Facades\Auth;

also you can Add use Illuminate\Support\Facades\Auth; at the top part of your controller class in Laravel. also you can read my prev post like as class ‘collective\html\htmlserviceprovider’ not found

You must use the Auth facade. Add this line to top part of your Laravel controller: resolve this error : Class ‘App\Http\Controllers\Auth’ not found

The error message “class ‘app\http\controllers\auth’ not found” suggests that the PHP interpreter is unable to find the Auth controller class within the specified namespace.

Here are a few possible reasons why this error might be occurring:

  1. The Auth controller class file is not present: Check if the Auth controller class file is present in the app/Http/Controllers directory. If the file is missing, you will need to create it.
  2. The namespace is incorrect: Check if the namespace of the Auth controller class is correct. In Laravel, the namespace for a controller should be in the format “App\Http\Controllers”. If the namespace is incorrect, you will need to update it to match the correct namespace.
  3. The class name is incorrect: Check if the class name of the Auth controller is correct. It should match the name of the controller file and should be in PascalCase format. If the class name is incorrect, you will need to update it to match the correct name.
  4. The Autoloader is not configured correctly: Check if the Autoloader is configured correctly. In Laravel, the Autoloader is configured by default, but if you have made any changes to it or are using a custom Autoloader, make sure it is configured correctly.
  5. The controller is not being called correctly: Check if the controller is being called correctly in your code. The syntax for calling a controller in Laravel is as follows:
Route::get('/path', '[ControllerName]@[MethodName]');

Make sure that you have specified the correct ControllerName and MethodName in your code.

By addressing these possible reasons, you should be able to resolve the “class ‘app\http\controllers\auth’ not found” error in Laravel.

I hope you get an idea about class ‘auth’ not found.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype