Laravel make:auth custom folder

1.4k views Asked by At

I'm new to using laravel 5.7.

I made a make:auth and to authenticate I need use http://localhost:8000/login and when I login I get redirected to http://localhost:8000/home, but I want login on http://localhost:8000/admin-panel/login and when I auth, I have to redirect to http://localhost:8000/admin-panel/home

Which files I will have to edit?

routes/web.php:

Route::get('/', function () { return view('welcome'); }); 
Auth::routes(['register' => false]);
Route::get('/home', 'HomeController@index')->name('home');
2

There are 2 answers

7
Tarek Adam On BEST ANSWER

routes/web.php

Route::group(['prefix' => 'admin-panel'], function(){
    Route::get('/', function () { return view('welcome'); });
    Auth::routes(['register' => false]);
    Route::get('/home', 'HomeController@index')->name('home');  
});

to see all your routes put this in the command line at your project root

php artisan route:list
0
Vinay Kaithwas On

I think your intention is use prefix on route group.

Route::prefix('/admin-panel')->namespace('admin-panel')->group(function()
{                                     
 Route::get('/dashboard', 'AdminController@AdminDashboard')->name('dashboard');
});

After this your route behave like this

 Route::get('/admin-pannel/dashboard', 'admin-pannel/AdminController@AdminDashboard')->name('dashboard');