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

Posted 3 months 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.

Reply to

Use Markdown with GitHub-flavored code blocks.