When I try to update a model with this code:
public function updateMixedtape($slug, Request $request)
{
$mix = Mix::where('slug', $slug)->get();
$mix->update($request->all());
return redirect('dashboard/mixes');
}
I get an error that method update doesn't exist. However if I modify my view to send a radio_show_id instead of slug and try to change the code to something like this:
public function updateMixedtape(Request $request)
{
$mix = Mix::findOrFail($request->radio_show_id);
$mix->update($request->all());
return redirect('dashboard/mixes');
}
The code executes without any errors.
What puzzles me is that if I do something like return $mix; before the line where I call the update method, I get similar data for both methods.