4

In my Laravel app I have different auth for administrators and users. So I have separete views as well. I have placed auth views folder inside admin folder, so that the view path to my admin auth is now admin.auth.login for example. Where can I change those paths so that I can use them for all the auth functions?

Ludwig
  • 1,401
  • 13
  • 62
  • 125

1 Answers1

6

If you take a look at your app\Http\Controllers\Auth\LoginController.php, you will see:

use AuthenticatesUsers;

It's a traits, you can find all the login related method over there in use Illuminate\Foundation\Auth\AuthenticatesUsers.php.

There's a method in the trait which show the view as below:

public function showLoginForm()
{
    return view('auth.login');
}

What you want to do is either:

  • Copy the traits out to your own one and modify the showLoginForm method.

or

  • Override the method showLoginForm in your LoginController.php. See this
Community
  • 1
  • 1
SteD
  • 13,909
  • 12
  • 65
  • 76
  • Yes, I had to change for each auth function login, register, forgot/reset password new view paths with overwriting the functions in my controller. I just hoped that there would be a shorter way of doing that. – Ludwig Oct 19 '16 at 07:47