Paul Paul - 10 months ago 68
PHP Question

Trait 'Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers' not found in Laravel 5.3

How to solve this problem? I alreay tried to use all the solution from the net and i tried also to use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers but none of them works?. If anyone knows how to solve this please help me. I want to get rid of this error. Thanks in advance


namespace App\Http\Controllers\Auth;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Redirect;

use Illuminate\Routing\Controller as BaseController;
use Theme;
use Auth;
use App\Login;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use App\Http\Controllers\Auth\RegisterController;
class LoginController extends BaseController

| 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 AuthenticatesAndRegistersUsers, ThrottlesLogins;

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

* Create a new controller instance.
* @return void

public function __construct()
$this->middleware('guest', ['except' => 'logout']);

public function signin(){


return Redirect::to('/');

$theme = Theme::uses('default')->layout('default');
return $theme->of('login.sign-in')->render();


public function login(){

$data = array(
'email' => Input::get('email'),
'password' => Input::get('password')

$validator= RegisterController::validator($data);

return Redirect::to('/login')->withErrors([$validator->errors()->all() ]);
return Redirect::to('/');

// RegisterController::create($data);

// Login::Insert($data);
// $checkuser = Login::Login($data);

function logout(){
return Redirect::to('login');


Answer Source

I think the Laravel 5.3 package does not have that trait. Please check here.


You need to make a few changes to how new users are validated and created because of AuthenticatesAndRegistersUsers no longer exist into laravel 5.3

So you need to make a change:

1 No need to pass the Guard and Registrar instances to the base constructor. Remove these dependencies entirely from your controller's constructor.

2 No need to use App\Services\Registrar class which is used in Laravel 5.0 just copy and paste your validator and create method from this class directly into your AuthController.

Make sure that the import the Validator facade and your User model at the top of your AuthController.