#Named route
$url = route('profile');
With parameters
// Route::get('/user/{id}/profile', /\*...\*/ )->name('profile);
$url = route('profile', ['id' => 1]);
// /user/1/profile/
With query string
// Route::get('/user/{id}/profile', /\*...\*/ )->name('profile);
$url = route('profile', ['id' => 1, 'photos'=>'yes']);
// /user/1/profile?photos=yes
#Redirects
// Generating Redirects...
return redirect()->route('profile');
#Eloquent Models
echo route('post.show', ['post' => $post]);
The route helper will automatically extract the model's route key. See Routing
Comments