Facing this error message but not sure what is wrong with it? Tried the solutions at StackOverflow and other forums but didn't work either.
The error is at line $review->title=$request->title;
public function updateReview(Request $request)
{
// dd($request->all());
$review = Review::find($request->id);
$review->id=$request->id;
$review->title=$request->title;
$review->review=$request->review;
$review->rating=$request->rating;
$review->save();
return redirect('/');
}
A dd($request->all()); returns the following:
array:5 [▼
"id" => "3"
"title" => "User 3 has updated title"
"review" => "User 4 just updated review"
"rating" => "5"
"_token" => "pGFVAzHNg7HmXbkMXylxcM6biqaGnwFmsxjsrTgl"
]
And these are my routes:
Route::get('/edit_review/{id}', 'App\Http\Controllers\UserController@editReview');
Route::post('/update', 'App\Http\Controllers\UserController@updateReview')->middleware('user');