mardi 27 octobre 2015

It is possible to use one route with two functions in Laravel 5.1?

Route::get('post/form/{id}', array('as' => 'admin.post.delete', 'uses' => "PostController@deleteForm"));

Route::get('post/form', array('as' => 'admin.post.create', 'uses' => "PostController@createForm"));

I want to combine two routes above in a route for two functions, create and delete. Because the both routes have only different id.

Route::get('post/form/{id}', array('as' => 'admin.post', 'uses' => "PostController@getForm"));

If I want to type without id, it redirects to create function. If I type with id, it redirect to delete function.

How can I use one route for two functions?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire