Hello I am using Laravel 5.2 version. I installed the laravel project via composer. After that I use command "php artisan make:auth" for create auth. After created auth route is generated for example "http://localhost:8000/login". Now I don't want this route I want to set different route for example "http://localhost:8000/super/admin". So How can I change the "http://localhost:8000/login" to "http://localhost:8000/super/admin". And when auth generated that time /register route is create so that route i want to remove "http://localhost:8000/register" route. Please suggest me how to do this. Thanks in advance.
To change the login URL's you should look for the Route::auth() method inside your routes/web. php and remove it.
Auth::routes() is just a helper class that helps you generate all the routes required for user authentication. You can browse the code here https://github.com/laravel/framework/blob/5.3/src/Illuminate/Routing/Router.php instead.
Follow these simple steps
If you have Route::auth()
in your routes.php
, then please remove that line.
Now add the following lines to your routes.php
Route::get('super/admin', 'Auth\AuthController@getLogin')->name('auth.login.get');
Route::post('super/admin', 'Auth\AuthController@postLogin')->name('auth.login.post');
Route::get('super/admin/logout', 'Auth\AuthController@getLogout')->name('auth.logout.get');
Then go to login.blade.php
(most probably in resources->views->auth)
And change the form action to {{ route('auth.login.post') }}
, like this...
<form action="{{ route('auth.login.post') }}" method="post">
Hope this answers everything :)
In App\Http\Controllers\Auth\LoginController
- define a fuction named showLoginForm() as:
public function showLoginForm()
{
$view = property_exists($this, 'loginView')
? $this->loginView : 'auth.authenticate';
if (view()->exists($view)) {
return view($view);
}
return view('auth.login');
}
It overrides the function showLoginForm defined in the trait Illuminate\Foundation\Auth\AuthenticatesUsers.
Note: In Laravel 5.3 the function name is changed from getLogin to showLoginForm.
For details goto
Illuminate\Foundation\Auth\AuthenticatesUsers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With