Class ‘App\Http\Controllers\Auth’ Not Found In Laravel


In this tutorial, we learn Class ‘App\Http\Controllers\auth’ not found in Laravel. The auth variable is the global variable and uses auth, you need to auth library. Auth use is to protect the administrator.

If you faced this problem so go to your page and find use auth under namespace.

Class ‘App\Http\Controllers\Auth’ Not Found In Laravel - Step By Step

If you are getting error like Class ‘App\Http\Controllers\Auth’ not found on controller in laravel.

So, add use Auth; at the top of your controller file along with other prefixes:

use Auth;
 
OR
 
Illuminate\Support\Facades\Auth;
Example:

Then YourController.php file, add use Auth; at the top of your controller a file like the following:

<?php 
namespace App\Http\Controllers;
 
use Illuminate\Http\Request;
 
use Auth;
 
class YourController extends Controller
{
    public function index(Request $request)
    {
        //your code
    }
 
}

I hope it can help you...

Leave a Reply

Your privacy will not be published. Required fields are marked *

We'll share your Website Only Trusted.!!

close