Support the ongoing development of Laravel.io →
Database Eloquent Forms
Last updated 2 years ago.
0

In your TutorialController I am assuming that $input is an array that does not contain _method because that would be a silly bug to still have in the core Input class. So that leaves the only thing I can think of being that where your injecting Tutorial into the update method of your TutorialController the IoC is adding the _method to the models properties.

I'd suggest checking the changed properties on that Tutorial model by adding dd($tutorial->getDirty()); to the update method before the line reading $tutorial->update($input); If _method is found in that output then that is your problem, otherwise I am unsure what else it could be.

0

carbontwelve said:

In your TutorialController I am assuming that $input is an array that does not contain _method because that would be a silly bug to still have in the core Input class. So that leaves the only thing I can think of being that where your injecting Tutorial into the update method of your TutorialController the IoC is adding the _method to the models properties.

I'd suggest checking the changed properties on that Tutorial model by adding dd($tutorial->getDirty()); to the update method before the line reading $tutorial->update($input); If _method is found in that output then that is your problem, otherwise I am unsure what else it could be.

I updated my question. In my method i changed

Request::all()

to

 $input = Input::except('_method');

But now i am still getting the error with the _token field:

Column not found: 1054 Unknown column '_token' in 'field list' (SQL: update tutorials set _token =

Last updated 9 years ago.
0

Hi Chris, you need to add _token to the input exclusion, when using the form helper it adds a hidden input field called _token which is part of Laravels csrf protection.

Simply update $input = Input::except('_method'); to be $input = Input::except(['_method', '_token']);

0

carbontwelve said:

Hi Chris, you need to add _token to the input exclusion, when using the form helper it adds a hidden input field called _token which is part of Laravels csrf protection.

Simply update $input = Input::except('_method'); to be $input = Input::except(['_method', '_token']);

Super - this is working, thanks :) By the way: Do you have an idea why my method updates all records instead of the one i am editing ? It seems the update function gets no ID from the public function update(Tutorial $tutorial) method.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

kayyyy kayyyy Joined 21 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.