Trait 'App\Http\Controllers\Auth\AuthenticatesUsers' not found'

Posted 1 month ago by dokunbam

Symfony\Component\Debug\Exception\FatalErrorException …\app\Http\Controllers\Auth\LoginController.php

I made some changes to the loginController, I cant seem to get what I did wrong again

<?php

namespace Transcribe\Http\Controllers\Auth;
use Transcribe\Http\Controllers\Auth\Auth;
use Transcribe\Http\Controllers\Controller;
use Transcribe\Http\Controllers\Auth\AuthenticatesUsers;



class LoginController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles authenticating users for the application and
    | redirecting them to your home screen. The controller uses a trait
    | to conveniently provide its functionality to your applications.
    |
    */
    

    use AuthenticatesUsers;

    /**
     * Where to redirect users after login.
     *
     * @var string
     */
    protected $redirectTo = '/home';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }

    protected function authenticated($request, $user)
    {
        if($user->hasRole('ROLE_ADMIN')) {
            return redirect('/admin');
        } elseif ($user->hasRole('ROLE_SUPERADMIN')) {
            return redirect('/superadmin');
        } else {
            return redirect('/home');
        }
    }
}

Can someone please help out Thanks

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.