How to solve the error of statically calling non-static method 'update'?
P粉032900484
2023-08-25 21:22:08
<p>This is my function.
I am getting an error in it, please help me to resolve this error and tell me why this error is appearing. </p>
<pre class="brush:php;toolbar:false;">public function update(Request $request)
{
$id = $request->id;
$grade = Grade::find($id);
$grade = $request->validate([
'title' => 'required|string',
'slig' => 'string',
'description' => 'string',
]);
$grade = Grade::update($grade);
return [
'staus' => 'success',
'grade' => $grade,
];
}</pre>
First create an instance. But I don't think that's the real issue.
Try changing your method as follows: