Question

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,

Était-ce utile?

La solution

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

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

Autres conseils

that method is generate a html element, and it have not DELETE method, you need a form with DELETE method to do that

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top