Laravel Eloquent $model->save() not saving but no error
Check your database table if the 'id' column is in uppercase 'ID'. Changing it to lower case allowed my save() method to work.
I had the same and turned out to be because I was filtering the output columns without the primary key.
$rows = MyModel::where('...')->select('col2', 'col3')->get();foreach($rows as $row){ $rows->viewed = 1; $rows->save();}
Fixed with
$rows = MyModel::where('...')->select('primary_key', 'col2', 'col3')->get();
Makes perfect sense on review, without the primary key available the update command will be on Null.
Since Laravel 5.5 laravel have change some validation mechanism I guess you need to try this way.
public function store(Request $request, $id){ $post = Post::findOrFail($id); $validatedData = []; // Request validation if ($post->type == 1) { // Post type has title $validatedData = $request->validate([ 'title' => 'required|min:15', 'body' => 'required|min:19', ]); } else { $validatedData = $request->validate([ 'body' => 'required|min:19', ]); } $post->update($validatedData); return redirect('/');}