As Mark Davidson said, this is not possible out of the box. But this is how I did it.
Now this may be redundant, but I am passing an array of what I need. If no parameters are passed, default routes are created.
// Include the authentication and password routes Route::auth(['authentication', 'password']);
/** * Register the typical authentication routes for an application. * * @param array $options * @return void */ public function auth(array $options = []) { if ($options) { // Authentication Routes... if (in_array('authentication', $options)) { $this->get('login', 'Auth\ AuthController@showLoginForm '); $this->post('login', 'Auth\ AuthController@login '); $this->get('logout', 'Auth\ AuthController@logout '); } // Registration Routes... if (in_array('registration', $options)) { $this->get('register', 'Auth\ AuthController@showRegistrationForm '); $this->post('register', 'Auth\ AuthController@register '); } // Password Reset Routes... if (in_array('password', $options)) { $this->get('password/reset/{token?}', 'Auth\ PasswordController@showResetForm '); $this->post('password/email', 'Auth\ PasswordController@sendResetLinkEmail '); $this->post('password/reset', 'Auth\ PasswordController@reset '); } } else { // Authentication Routes... $this->get('login', 'Auth\ AuthController@showLoginForm '); $this->post('login', 'Auth\ AuthController@login '); $this->get('logout', 'Auth\ AuthController@logout '); // Registration Routes... $this->get('register', 'Auth\ AuthController@showRegistrationForm '); $this->post('register', 'Auth\ AuthController@register '); // 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 '); } }
In your case, you can just pass the boolean as parameter instead of array . If the boolean value is true , then do not load register routes, otherwise load everything.
Hope this helps.
camelCase
source share