Thursday, 15 January 2015

php - Custom method instead of resource for Laravel routes -


Try using

4.2 and trying to add custom method to my controller.

My routes are:

  Route: Receive ('Ticket / Pass_ticket / {ID}', 'TickController @ Close_ticket'); Root :: Resources ('Ticket', 'Tick Stroller');  

The CRUD works like an intelligent, but I have this basic task at the bottom of my ticket controller:

  public function close_ticket ($ id) {Return "saved - off"; }  

When I am showing a link to the path on my page:

  {{link_to_route ('ticket / pass_ticket /' $ ticket- ID, 'Mark as close', array ($ ticket-id), array ('class' = & gt; BTN BTN-success'))}}  

Is not a route defined error, but it is definitely defined ...?

Any idea where this is going wrong?

Laurwell helpful method link_to_route generates an HTML link that means When clicked, the user will be requesting a GET .

In your root file, you are defining it as the POST route

Route: Post (...) < / Code>

In addition, take a look at the link_to_route docs here:

You will see that the first argument is < Em> bus without the ID name, the name of the route should be.


No comments:

Post a Comment