jeudi 3 mars 2016

Laravel 5 - NotFoundHttpException for update

I have a strange situation I am struggling to work out. I have the following in my route file

Route::model('campaigns.campaignEmailLinks', 'CampaignEmailLinks');
Route::resource('campaigns.campaignEmailLinks', 'CampaignData\CampaignEmailLinksController', ['except' => ['index', 'create', 'show', 'edit', 'destroy']]);

If I view my routes, I can see what I would expect

campaigns/{campaigns}/campaignEmailLinks                            | campaigns.campaignEmailLinks.store
campaigns/{campaigns}/campaignEmailLinks/{campaignEmailLinks}       |
campaigns/{campaigns}/campaignEmailLinks/{campaignEmailLinks}       | campaigns.campaignEmailLinks.update

I have a CampaignEmailLinksController with a store and update function. The form for the create view looks like so

{!! Form::model(new App\CampaignModels\CampaignEmailLinks, [
     'class'=>'form-horizontal',
     'route' => ['campaigns.campaignEmailLinks.store', $campaign->id]
 ]) !!}

And for the edit view it looks like this

{!! Form::model($campaign->campaignEmailLinks, [
     'class'=>'form-horizontal',
     'method' => 'PATCH',
     'route' => ['campaigns.campaignEmailLinks.update', $campaign, $campaign->campaignEmailLinks]
 ]) !!}

This is whats weird. My create view is displayed, I enter data, it saves successfully to my database without any problems. It then displays the edit page without any issues. However, if I try to save on the edit form, I get a NotFoundHttpException.

This is the same process as I have handled other models, and none of these have any issues. The route must be correct otherwise the create would not work, would it?

Am I missing something obvious here? Is there any way I can get more detailed error information to see what the exact problem is, or where it is?

Any information appreciated.

Thanks



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/21GYS6N
via IFTTT

Aucun commentaire:

Enregistrer un commentaire