As the documentation says the function Redirect::action()
receives a string which is separated into 2 parts by the symbol @
eg Redirect::action('MyController@myFunction')
I've recently tried to give the function an input: Redirect::action('someRouteName')
and see what's gonna happen. Surprisingly it didn't return with an error but actually made the link just as if I was using the Redirect::route()
function (I had a route named as someRouteName
).
Does the function Redirect::action()
falls back to Redirect::route()
if the value it gets is invalid? Couldn't find any source that says that.
Yes, it does. Some insight on it can be seen in sources.
https://github.com/laravel/framework/blob/master/src/Illuminate/Routing/UrlGenerator.php#L455
/**
* Get the URL to a controller action.
*
* @param string $action
* @param mixed $parameters
* @param bool $absolute
* @return string
*/
public function action($action, $parameters = array(), $absolute = true)
{
return $this->route($action, $parameters, $absolute, $this->routes->getByAction($action));
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.