Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel changing url name

So I'm using the laravel auth because I wanted to have a registration system on my website.

However because my website is Dutch, I'd like to change the url from localhost:8000/login to localhost:8000/inloggen and the same for register.

Does anyone know if this is possible and how to do this?

I couldn't find anything on Google about this so that's why I'm asking here.

Thanks in advance.

like image 703
Max Avatar asked Jan 01 '23 19:01

Max


2 Answers

You could add this in routes/web.php:

Route::get('/inloggen', 'Auth\LoginController@showLoginForm' );
Route::post('/inloggen', 'Auth\LoginController@login');

You can find all Auth::routes here: https://github.com/laravel/framework/blob/5.7/src/Illuminate/Routing/Router.php#L1144

like image 56
Ron van der Heijden Avatar answered Jan 04 '23 10:01

Ron van der Heijden


Just remove Auth::routes(); from your routes/web, And write auth routes manualy.

Here is default auth routes list. enter image description here

You can write your own route for each of them. For example:

Route:post('inloggen', 'Auth\LoginController@login')
Route::get('inloggen', 'Auth\LoginController@showLoginForm')->name('login');
// And other auth routes
like image 34
Egretos Avatar answered Jan 04 '23 08:01

Egretos