I want to change the auth process to use another view template. E.g. instead of resources/views/auth/register.blade.php
it shall be used resources/views/register.blade.php
.
But I struggle to find the code where this view is called.
The only place I found was in app/Services/Register
but only if the validators fails. I need the place when the view is called per default.
Laravel 5.6- I am extending Amarnasan's answer
In Laravel 5.6, there is no AuthController.php
. Instead of that, there are 4 different controllers.
LoginController.php
RegisterController.php
ForgotPasswordController.php
ResetPasswordController.php
To override the view of any Auth controller, Just look for the trait that Auth controller is using. Then, Go to that trait file and check which method is returning the default view for the Auth controller.
To change the default view for login
add the following in LoginController.php
public function showLoginForm() {
return view('auth.m-login');
}
To change the default view for Registration
add the following in RegisterController.php
public function showRegistrationForm() {
return view('auth.m-register');
}
To change the default view for Forgot password
add the following in ForgotPasswordController.php
public function showLinkRequestForm(){
return view('auth.passwords.m-email');
}
To change the default view for Reset password
add the following in ResetPasswordController.php
public function showResetForm(Request $request, $token = null){
return view('auth.passwords.m-reset')->with(
['token' => $token, 'email' => $request->email]
);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With