I am using a form with PATCH
method and I have a button link(since i already have a submit button and using same form for both store and update) as
<a class="btn btn-default" href="{{ URL::to( 'pages/edit/' . $vehicle -> id) }}">EDIT</a>
And my route is
Route::patch('/pages/edit/{id}', ['uses' => 'VehicleProcessController@update']);
Controller
public function update($id)
{
$vehicle = Vehicle::find($id);
$input = Input::all();
$vehicle->update($input);
return $input;
}
When i click to link $input
returns null and i am getting
MethodNotAllowedHttpException
I am trying to get familiar with L5, how can i fix this ? Any help would be appreciated.
Your
<a>
link will trigger aGET
request, not aPATCH
request. You can use JS to have it trigger aPATCH
request, or use a<button>
or<input type="submit">
to issue one.