I am getting the MethodNotAllowedException
error whenever I try to submit a PATCH
request to my controller. It only occurs on my nested route, all other routes that run the PATCH
request work great.
routes.php:
Route::resource('customers.aircraft','AircraftController');
my form:
Form::model($aircraft, ['method' => 'PATCH', 'class' => 'form-horizontal', 'action' => ['AircraftController@update', $aircraft->id]])
Each aircraft belongs to a customer. My URL looks like this:
http://ift.tt/1NuBnCf
What I'm observing in the address bar when I get the error message is this:
http://ift.tt/1S1oogJ
I have determined that this cannot be caused by the controller, because the very first line in my @update
method is dd($request);
and it doesn't get that far. I assume the issue is that the route is not getting the information it needs to direct my request, it is obviously taking the aircraft_id
and using it as the customer_id
, but I cannot figure out how or why.
I have tried this:
Form::model($aircraft, ['method' => 'PATCH', 'class' => 'form-horizontal', 'action' => ['AircraftController@update', [$customer_id, $aircraft->id]]])
Thinking that it needed the customer_id
to be sent through, but that didn't work. I'm pretty new to Laravel
so I do expect this is just a lack of knowledge, however nothing on Stackoverflow, Laravel or Laracasts websites have helped me so far.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire