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.
carbontwelve said:
In your TutorialController I am assuming that
$inputis 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 injectingTutorialinto the update method of your TutorialController the IoC is adding the_methodto the models properties.I'd suggest checking the changed properties on that
Tutorialmodel by addingdd($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 =
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']);
carbontwelve said:
Hi Chris, you need to add
_tokento 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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.