gman01
1926
9
Laravel

App\Http\Controllers\Auth not found.

Posted 2 years ago by gman01

Hi,

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.

<?php

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()
    {
        $this->middleware('auth');
    }

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

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

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

Reply to

Use Markdown with GitHub-flavored code blocks.