gman01
131
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.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.