前提・実現したいこと
laravel5.6でauthの機能を利用してurlを/loginから/Adminloginなどに変更したい。
発生している問題・エラーメッセージ
vendor\laravel\framework\src\Illuminate\Routing\Router.php
の以下の箇所をoverrideしてloginの箇所を変更すればいいのかと考えてoverrideしようとしたのですが、うまくできなかったです。
Router.php
php
1 /** 2 * Register the typical authentication routes for an application. 3 * 4 * @return void 5 */ 6 public function auth() 7 { 8 // Authentication Routes... 9 $this->get('login', 'Auth\LoginController@showLoginForm')->name('login'); 10 $this->post('login', 'Auth\LoginController@login'); 11 $this->post('logout', 'Auth\LoginController@logout')->name('logout'); 12 13 // Registration Routes... 14 $this->get('register', 'Auth\RegisterController@showRegistrationForm')->name('register'); 15 $this->post('register', 'Auth\RegisterController@register'); 16 17 // Password Reset Routes... 18 $this->get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request'); 19 $this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email'); 20 $this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset'); 21 $this->post('password/reset', 'Auth\ResetPasswordController@reset'); 22 }
試したこと
試したことはapp\Providers\RoutingServiceProvider.phpを作成してconfig\app.phpにproviderの追加をしましたが、うまくいきませんでした。
調べてみたのですが、見つからなかったので、助けてください。
RoutingServiceProvider.php
php
1<?php 2 3namespace App\Providers; 4 5use Illuminate\Routing\Router; 6 7class RoutingServiceProvider extends Router 8{ 9 /** 10 * This namespace is applied to your controller routes. 11 * 12 * In addition, it is set as the URL generator's root namespace. 13 * 14 * @var string 15 */ 16 protected $namespace = 'App\Http\Controllers'; 17 18 19 /** 20 * Register the typical authentication routes for an application. 21 * 22 * @return void 23 */ 24 public function auth() 25 { 26 // Authentication Routes... 27 $this->get('Adminlogin', 'Auth\LoginController@showLoginForm')->name('login'); 28 $this->post('Adminlogin', 'Auth\LoginController@login'); 29 $this->post('Adminlogin', 'Auth\LoginController@logout')->name('logout'); 30 31 // Registration Routes... 32 $this->get('register', 'Auth\RegisterController@showRegistrationForm')->name('register'); 33 $this->post('register', 'Auth\RegisterController@register'); 34 35 // Password Reset Routes... 36 $this->get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request'); 37 $this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email'); 38 $this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset'); 39 $this->post('password/reset', 'Auth\ResetPasswordController@reset'); 40 } 41}
app.php
php
1 'providers' => [ 2 3 App\Providers\RoutingServiceProvider::class, // 追加 4 ], 5
補足情報(FW/ツールのバージョンなど)
laravel5.6
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/03/15 14:26