make:auth
で作成された認証コンポーネントのルートを変更するにはどうすればよいですか?laravelのmake:authコントローラの表示パスを変更するにはどうすればよいですか?
routes/web.php
は、私が/account
に、例えば、レジスタのパスを変更するにはどうすればよい
Auth::routes();
が含まれていますか?あなたの認証コントローラへ
make:auth
で作成された認証コンポーネントのルートを変更するにはどうすればよいですか?laravelのmake:authコントローラの表示パスを変更するにはどうすればよいですか?
routes/web.php
は、私が/account
に、例えば、レジスタのパスを変更するにはどうすればよい
Auth::routes();
が含まれていますか?あなたの認証コントローラへ
LaravelのAuth::routes();
あなたはこの機能の内容をコピーしてweb.php
ファイルに直接貼り付けることができvendor/laravel/framework/src/Illuminate/Routing/Router.php
で定義された関数auth()
を使用してリダイレクトを上書きすることができます必要に応じて更新してください。
public function auth()
{
// Authentication Routes...
$this->get('login', 'Auth\[email protected]')->name('login');
$this->post('login', 'Auth\[email protected]');
$this->post('logout', 'Auth\[email protected]')->name('logout');
// Registration Routes...
$this->get('register', 'Auth\[email protected]')->name('register');
$this->post('register', 'Auth\[email protected]');
// Password Reset Routes...
$this->get('password/reset', 'Auth\[email protected]')->name('password.request');
$this->post('password/email', 'Auth\[email protected]')->name('password.email');
$this->get('password/reset/{token}', 'Auth\[email protected]')->name('password.reset');
$this->post('password/reset', 'Auth\[email protected]');
}
ここでは、/register
の経路を変更することができます。これを行うときにAuth::routes()
ヘルパーをweb.phpから削除することを忘れないでください。
ゴーあなたが
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after login/registration.
*
* @var string
*/
protected $redirectTo = '/';