1

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.

1
  • route('name') ? Commented Nov 7, 2017 at 20:09

2 Answers 2

1

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])

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot! This was so simple that I missed it... Using syntax route('model.index') worked magic :)
1

To directly redirect to a named route, use:

return redirect()->route('NAME'); 

To see the path to a named route, use:

echo route('NAME'); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.