📜  laravel api 表单请求验证 404 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:36.980000             🧑  作者: Mango

代码示例1
Set an "Accept": "application/json" Request Header
 -- OR --
force the default response behavior by sepcifying the response() method
in your own CustomFormRequest class:
// -- example -- //
public function response(array $errors)
{
    // Always return JSON.
    return response()->json($errors, 422);
}