Why are they the same name and url?
Either way.. Move the second to a controller
The first you can use the view() route method
Route::middleware(['auth:sanctum,web', 'verified'])->view('/dashboard', 'dashboard')->name('dashboard');
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am getting this error after php artisan route:cache on production server :
LogicException
Unable to prepare route [dashboard] for serialization. Another route has already been assigned name [dashboard].
at vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php:218 214▕ $route->name($name = $this->generateRouteName()); 215▕ 216▕ $this->add($route); 217▕ } elseif (! is_null($symfonyRoutes->get($name))) { ➜ 218▕ throw new LogicException("Unable to prepare route [{$route->uri}] for serialization. Another route has already been assigned name [{$name}]."); 219▕ } 220▕ 221▕ $symfonyRoutes->add($route->getName(), $route->toSymfonyRoute()); 222▕
+19 vendor frames
20 artisan:37 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
Few Routes :
Route::middleware(['auth:sanctum,web', 'verified'])->get('/dashboard', function () {
return view('dashboard');
})->name('dashboard');
// User Routes
Route::middleware(['auth:sanctum,web', 'verified'])->get('/dashboard', function () {
$id = Auth::user()->id;
$user = User::find($id);
return view('dashboard',compact('user'));
})->name('dashboard');
Why are they the same name and url?
Either way.. Move the second to a controller
The first you can use the view() route method
Route::middleware(['auth:sanctum,web', 'verified'])->view('/dashboard', 'dashboard')->name('dashboard');
Please or to participate in this conversation.