Search code examples
laravel-4link-toactioncontroller

Laravel 4 link_to_action


Good afternoon,

I'm trying to create a link to run my destroy action. Reading the documentation of Laravel 4, it should perform as follows:

link_to_action cast ('@ getIndex HomeController', $ title, $ parameters = array (), $ attributes = array ());

My code:

{{Link_to_action ('CompaniesController @ destroy', 'Test', array ($ company-> id), array ('class' => 'btn btn btn-sm-info'))}}

But when I got to the link, it redirects me to show the controller action, when the action should send me to destroy.

Thanks in advance,


Solution

  • In laravel -4 use this. You are following laravel 3 format:

    {{ HTML::linkAction('CompaniesController@destroy', 'Test' , array ('class' => 'btn btn btn-sm-info')) }}