Reputation: 191
I am opening a form inside one of the pages generated by JeffreyWay's laravel generator. Except it keeps saying unknown action even though i added the action in the WorkorderController. If I change it to the default actions that was created it worked fine.. like action => 'WorkordersController@create'
Does anyone know how to register a new action using the Route::Resource?
Thanks!
in my form
{{ Form::open(array('action' => 'WorkordersController@time')) }}
in my WorkorderController
public function time()
{
return 'hello world';
}
in my routes
Route::resource('workorders', 'WorkordersController');
Upvotes: 1
Views: 1774
Reputation: 87769
The fastest way to resolve this is creating a separate route to your action:
Route::resource('workorders', 'WorkordersController');
Route::post('workorders/time', array('as'=>'workorders.time', 'uses'=>'WorkordersController@time'));
But you also can extend the whole Laravel router system and add new actions.
Upvotes: 2