Reputation: 11338
How can I access route path for a named route in Laravel 5.5? As far as I've searched for this syntax, I haven't found such.
Upvotes: 1
Views: 1722
Reputation: 836
To directly redirect to a named route, use:
return redirect()->route('NAME');
To see the path to a named route, use:
echo route('NAME');
Upvotes: 1
Reputation: 1285
Name Route Path in Web.php
Route::get('/', 'ModelController@index')->name('model.index');
Route::get('/create', 'ModelController@create')->name('model.create');
Route::get('/edit/{paramerter}', 'ModelController@edit')->name('model.edit');
Accessing Route Path:
route('model.index')
Passing Parameter:
route('model.edit', ['parameter'=> $value])
Upvotes: 1