【laravel】Authのルーティング

# 概要
AuthのルーティングはRESTfulを利用しているため、ログインや新規登録を編集するために調べました。


# Authのルーティング
Authのルーティングは`\vendor\laravel\framework\src\Illuminate\Routing`のauthメソッドに記述されています。
authメソッドはオプション引数として配列型の`$options`が用意されており、引数に入る値次第でif文により条件分岐させています。

ここでは見やすいように、コメントや条件分岐によるメソッドの使用を一旦無視した内容を載せます。
詳細は次の段落に載せます。

```php:web
Auth::routes();
```

```php: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');
  }

  // 以下よりif文で条件分岐して別メソッドへ
  // Password Reset Routes...
  // Password Confirmation Routes...
  // Email Verification Routes...
}

// Password Reset Routes...
public function resetPassword()
{
  $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');
}

// Password Confirmation Routes...
public function confirmPassword()
{
  $this->get('password/confirm', 'Auth\ConfirmPasswordController@showConfirmForm')->name('password.confirm');
  $this->post('password/confirm', 'Auth\ConfirmPasswordController@confirm');
}

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

```

# 詳細
各メソッドをそのまま転記します。
気になるところがあれば追記します。


## auth()

```php:Router.php
/**
 * Register the typical authentication routes for an application.
 *
 * @param  array  $options
 * @return void
 */
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...
  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();
  }
}
```


## resetPassword()

```php:Router.php
/**
 * Register the typical reset password routes for an application.
 *
 * @return void
 */
public function resetPassword()
{
  $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');
}
```


## confirmPassword()

```php:Router.php
/**
 * Register the typical confirm password routes for an application.
 *
 * @return void
 */
public function confirmPassword()
{
  $this->get('password/confirm', 'Auth\ConfirmPasswordController@showConfirmForm')->name('password.confirm');
  $this->post('password/confirm', 'Auth\ConfirmPasswordController@confirm');
}
```


## emailVerification()

```php:Router.php
/**
 * Register the typical email verification routes for an application.
 *
 * @return void
 */
public function emailVerification()
{
  $this->get('email/verify', 'Auth\VerificationController@show')->name('verification.notice');
  $this->get('email/verify/{id}/{hash}', 'Auth\VerificationController@verify')->name('verification.verify');
  $this->post('email/resend', 'Auth\VerificationController@resend')->name('verification.resend');
}
```

# 参考