n How to know what routes are actually behind Auth::routes() in Laravel | CodimTh

Please Disable Your Browser Adblock Extension for our site and Refresh This Page!

our ads are user friendly, we do not serve popup ads. We serve responsible ads!

Refresh Page
Skip to main content
On . By CodimTh
Category:

You want to know what routes are actually behind Auth::routes()?

From Laravel 7, it’s in a separate package, so check the file


/vendor/laravel/ui/src/AuthRouteMethods.php.

public function auth()
{
 return function ($options = []) {

 // Authentication Routes...
 $this->get('login', 'Auth\LoginController@showLoginForm')->name('login');
 $this->post('login', 'Auth\LoginController@login');
 $this->post('logout', 'Auth\LoginController@logout')->name('logout');
 
// Registration Routes...
 if ($options['register'] ?? true) {
     $this->get('register','Auth\RegisterController@showRegistrationForm')->name('register');
     $this->post('register', 'Auth\RegisterController@register');
 }
 
// Password Reset Routes...
 if ($options['reset'] ?? true) {
    $this->resetPassword();
 }

 // Password Confirmation Routes...
 if ($options['confirm'] ?? class_exists($this->prependGroupNamespace('Auth\ConfirmPasswordController'))) {
    $this->confirmPassword();
 }

 // Email Verification Routes...
 if ($options['verify'] ?? false) {
   $this->emailVerification();
 }
 };
}


Before Laravel 7, check the file


/vendor/laravel/framework/src/illuminate/Routing/Router.php.


public function auth(array $options = [])
{
 // Authentication Routes...
 $this->get('login', 'Auth\LoginController@showLoginForm')->name('login');
 $this->post('login', 'Auth\LoginController@login');
 $this->post('logout', 'Auth\LoginController@logout')->name('logout');
 
// Registration Routes...
 if ($options['register'] ?? true) {
     $this->get('register','Auth\RegisterController@showRegistrationForm')->name('register');
     $this->post('register', 'Auth\RegisterController@register');
 }

 // Password Reset Routes...
 $this->get('password/reset','Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
 $this->post('password/email','Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
 $this->get('password/reset/{token}','Auth\ResetPasswordController@showResetForm')->name('password.reset');
 $this->post('password/reset','Auth\ResetPasswordController@reset')->name('password.update');
 
// Email Verification Routes...
 if ($options['verify'] ?? false) {
   $this->emailVerification();
 }
}


public function emailVerification()
{
  $this->get('email/verify','Auth\VerificationController@show')->name('verification.notice');
  $this->get('email/verify/{id}','Auth\VerificationController@verify')->name('verification.verify');
  $this->get('email/resend','Auth\VerificationController@resend')->name('verification.resend');
}

Riadh Rahmi

Senior Web Developer PHP/Drupal & Laravel

I am a senior web developer, I have experience in planning and developing large scale dynamic web solutions especially in Drupal & Laravel.

Web Posts

Search

Page Facebook