S
S
suhuxa12017-07-30 20:40:40
Laravel
suhuxa1, 2017-07-30 20:40:40

How to change auth paths in laravel?

I registered make:auth, as a result, the following construction was added to the router:
Auth::routes();
But how to change the paths? And where is the data from the form generally processed? I would like to Russify, change the authentication mechanism itself, make it not by email, but by login, and so on.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Aksentiev, 2017-07-30
@Sanasol

and what about the routes?
Controllers have everything you need, views have everything you need. What is not, you can pre-inherit and rule.

Y
Yurka Blokhin, 2017-07-30
@blrik

here are the routes, replace them with which you need

Route::get('login', ['as' => 'auth.login', 'uses' => 'Auth\[email protected]']);
Route::post('login', ['as' => 'auth.login', 'uses' => 'Auth\[email protected]']);
Route::get('logout', ['as' => 'auth.logout', 'uses' => 'Auth\[email protected]']);

// Registration Routes...
Route::get('register', ['as' => 'auth.register', 'uses' => 'Auth\[email protected]']);
Route::post('register', ['as' => 'auth.register', 'uses' => 'Auth\[email protected]']);

// Password Reset Routes...
Route::get('password/reset/{token?}', ['as' => 'auth.password.reset', 'uses' => 'Auth\[email protected]']);
Route::post('password/email', ['as' => 'auth.password.email', 'uses' => 'Auth\[email protected]']);
Route::post('password/reset', ['as' => 'auth.password.reset', 'uses' => 'Auth\[email protected]']);

V
volodec, 2018-08-07
@volodec

There is one more option.
Look for the auth() method in the vendor\laravel\framework\src\Illuminate\Routing\Router.php file and change the paths in it to the ones you need. In this case, you won't have to change anything in the routes\web.php file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question