4

I would like to get a route value by its name and store it in a variable.

The reason being, I would like to use the Redirect::intended($url) method to redirect the user to a route instead of just putting the url there.

Basically, I would like to have the same behavior as with Redirect::route($route_name) but with the intended() function.

Is there a method like Route::getValueByName() ?

Thank you very much.

tereško
  • 58,060
  • 25
  • 98
  • 150
Yassir Ennazk
  • 6,970
  • 4
  • 31
  • 37

1 Answers1

8

If I get you right, you could just use

Redirect::intended(route('home'));

OR

Redirect::intended('/');

OR EVEN

Redirect::intended(action('BaseController@index'));
peter.babic
  • 3,214
  • 3
  • 18
  • 31