我目前正在我的laravel项目中构建一个api,当我通过邮递员运行请求时出现500错误,在我的更新方法中一切似乎都没问题。任何人都可以帮我弄清楚我错过了什么?
public function update(Request $request, Status $status)
{
$validator = Validator::make($request->all(),[
'server' => 'required',
'status' => 'required'
]);
if($validator->fails()){
$response = array('response' => $validator->messages(), 'success' => false);
return $response;
} else {
$statusStore = Status::find($status);
$statusStore->server = $request->input('server');
$statusStore->status = $request->input('status');
$statusStore->save();
return response()->json($statusStore);
}
}