Reputation: 1392
I am having to work with code someone else wrote. I see they use the following syntax:
<a href="{{ action('MessagesController@index') }}">Messages</a>
Whereas I would have used :
<a href="messages">Messages</a>
and catered for that in routes.php
I am not sure why the "action" syntax is used - is it from an older version of Laravel perhaps?
I am using Laravel 5.3 currently
Thanks
Upvotes: 1
Views: 4378
Reputation: 699
The action
helper function is a function that generates a URL to the given action. See https://laravel.com/docs/5.4/helpers#method-action
It has been available since Laravel 5.1 (or roundabouts)
Upvotes: 2