For a purpose i decided to create a separate routing file for the admin and separating its logic from the web.php but instead i am facing this issue :
//admin.php ( routing file ) <?php use IlluminateSupportFacadesRoute; use IlluminateSupportFacadesAuth Route::get('/admin', function () { dd(Auth::user()); //return null });
ps: the admin.php is registered in the RouteServiceProvider
public function map() { $this->mapApiRoutes(); $this->mapWebRoutes(); $this->mapAdminRoutes(); // } protected function mapAdminRoutes() { Route::middleware('admin') ->namespace('AppHttpControllersAdmin') ->group(base_path('routes/admin.php')); }
Advertisement
Answer
Add web middleware
Route::middleware(['web','admin'])->...