Override default Auth routes in Laravel >= 5.4
For the googlers, here is a full list of routes that are getting generated by Auth::routes();
in Laravel >= 5.4
// Authentication Routes...
Route::get('login', [
'as' => 'login',
'uses' => 'Auth\LoginController@showLoginForm'
]);
Route::post('login', [
'as' => '',
'uses' => 'Auth\LoginController@login'
]);
Route::post('logout', [
'as' => 'logout',
'uses' => 'Auth\LoginController@logout'
]);
// Password Reset Routes...
Route::post('password/email', [
'as' => 'password.email',
'uses' => 'Auth\ForgotPasswordController@sendResetLinkEmail'
]);
Route::get('password/reset', [
'as' => 'password.request',
'uses' => 'Auth\ForgotPasswordController@showLinkRequestForm'
]);
Route::post('password/reset', [
'as' => 'password.update',
'uses' => 'Auth\ResetPasswordController@reset'
]);
Route::get('password/reset/{token}', [
'as' => 'password.reset',
'uses' => 'Auth\ResetPasswordController@showResetForm'
]);
// Registration Routes...
Route::get('register', [
'as' => 'register',
'uses' => 'Auth\RegisterController@showRegistrationForm'
]);
Route::post('register', [
'as' => '',
'uses' => 'Auth\RegisterController@register'
]);
php artisan route:list
will return
+--------+----------+------------------------+------------------+------------------------------------------------------------------------+--------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+----------+------------------------+------------------+------------------------------------------------------------------------+--------------+
| | GET|HEAD | login | login | App\Http\Controllers\Auth\LoginController@showLoginForm | web,guest |
| | POST | login | | App\Http\Controllers\Auth\LoginController@login | web,guest |
| | POST | logout | logout | App\Http\Controllers\Auth\LoginController@logout | web |
| | POST | password/email | password.email | App\Http\Controllers\Auth\ForgotPasswordController@sendResetLinkEmail | web,guest |
| | GET|HEAD | password/reset | password.request | App\Http\Controllers\Auth\ForgotPasswordController@showLinkRequestForm | web,guest |
| | POST | password/reset | password.update | App\Http\Controllers\Auth\ResetPasswordController@reset | web,guest |
| | GET|HEAD | password/reset/{token} | password.reset | App\Http\Controllers\Auth\ResetPasswordController@showResetForm | web,guest |
| | GET|HEAD | register | register | App\Http\Controllers\Auth\RegisterController@showRegistrationForm | web,guest |
| | POST | register | | App\Http\Controllers\Auth\RegisterController@register | web,guest |
+--------+----------+------------------------+------------------+------------------------------------------------------------------------+--------------+
You can also try this one.
// Replace admin with whatever prefix you need
Route::group(['prefix' => 'admin'], function () {
Auth::routes();
});
You can see list of routes by following command.
php artisan route:list
Routes for 5.5 LTS (Confirmed) / 5.6 (Confirmed) / 5.7 (?)
Can someone confirm it works with 5.7?
// Authentication Routes...
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login', 'Auth\LoginController@login');
Route::post('logout', 'Auth\LoginController@logout')->name('logout');
// Registration Routes...
Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
Route::post('register', 'Auth\RegisterController@register');
// Password Reset Routes...
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'Auth\ResetPasswordController@reset');