After running php artisan make:auth
all the required routes are in the route.php
file, but is it possible to remove one (I want to remove the register route)?
Currently I have
Route::group(['middleware' => 'web'], function () {
Route::auth();
});
I know that Route::auth()
is a shortcut to add all the routes.
Should I specify the routes myself instead of using the shortcut?
Unfortunately you can't exclude register with the current implementation of Route::auth()
.
You would have to specify all the routes manually so
// Authentication Routes...
$this->get('login', 'Auth\AuthController@showLoginForm');
$this->post('login', 'Auth\AuthController@login');
$this->get('logout', 'Auth\AuthController@logout');
// Password Reset Routes...
$this->get('password/reset/{token?}', 'Auth\PasswordController@showResetForm');
$this->post('password/email', 'Auth\PasswordController@sendResetLinkEmail');
$this->post('password/reset', 'Auth\PasswordController@reset');
I think this is a fairly common thing to want to do it would be nice if there was a parameter to the auth
method to say without register maybe you could submit a pull-request to the project.
In the new releases you can do it like so (in your web.php file):
Auth::routes(['register'=>false]);
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