What is the code that performs the update?
Usually just calling the save method on your model should do the trick.
$specifications = Specifications::updateOrCreate(array('id' => $id)+(Input::only('motor_type')));
return Redirect::to('control/motorcycles');
You should have a comma instead of the '+' sign, the signature for updateOrCreate is
static Model updateOrCreate(array $attributes, array $values = array())
The first argument being an array of attributes to match one or multiple records (in your case, the id will match only one), The second argument, is an array of values, in the form of [field => value] which are the properties and the values with which you want to update your model(s).
So, basically you should use the following line of code :
$specifications = Specifications::updateOrCreate(array('id' => $id), Input::only('motor_type'));
And it should do the trick. Hope that helps.
Thank you a lot! It works perfectly, just how I want.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community