Update Table Using Laravel Model
The error message tells you everything you know: you’re trying to call a method statically (using the double colons) that isn’t meant to be.
The update()
method is meant to be called on a model instance, so first you need to retrieve one:
$selection = Selection::find($id);
You can then can the update()
method on that:
$selection->update($request->all());
You should write it like given example below:
Selection::where('id', $input['id'])->update($input);// Or use this using dynamic whereSelection::whereId($input['id'])->update($input);
Alternatively, you may write it like this as well:
Selection::find($input['id'])->fill($input)->save();