In Laravel, Named Routes are a way to give a unique name to a route.
Instead of writing the full URL everywhere, you can just use the route’s name.
This makes your code cleaner, easier to maintain, and less error-prone.
Route::get('/user/profile', function () {
return 'User Profile';
})->name('profile');Here, the route’s name is profile.
You can create URLs for named routes like this:
$url = route('profile');/user/profile
return redirect()->route('profile');Route::get('/user/{id}/profile', function ($id) {
return "Profile of user: " . $id;
})->name('user.profile');
$url = route('user.profile', ['id' => 5]);/user/5/profile