App\Http\Controllers\Auth not found.

Published 2 years ago by gman01


I'm trying to get all rows where user = logged in user, but keep getting:

Class 'App\Http\Controllers\Auth' not found, I've tried adding it in to the top of the controller.


use Illuminate\Support\Str;

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\User;

use App\Client;

use App\Note;

use App\Product;

use App\Http\Requests\ClientRequest;

use App\Http\Requests;

use Carbon\Carbon;

class MyClientsController extends Controller
     * Create a new controller instance.
     * @return void
    public function __construct()

    public function index() {
         $clients = Client::where('id', Auth::user()->id)->get();

         return view('my_clients.index', compact('clients'));


Where have you added it? I don't see it...


You need to add a use statement at the top or use the helper function auth() in place of the facade.


use Illuminate\Support\Facades\Auth;


I had tried adding it at the top but I still get the same error.


OK I got it.


@gman01 solved?


Probably the issue is in the Kernel.php in http folder


Yes I was calling something else as well that was conflicting with it.


actually you've not been importing the Auth facade, so he tried to look for an Auth class that existing in the current directory. Good to know that is solved

Please sign in or create an account to participate in this conversation.