修改不存在的话题时,404 错误不生效
修改不存在的话题时,404 错误不生效 403错误正常
app/Providers/AppServiceProvider.php
\API::error(function (\Illuminate\Database\Eloquent\ModelNotFoundException $exception) {
abort(404);
});
\API::error(function (\Illuminate\Auth\Access\AuthorizationException $exception) {
abort(403, $exception->getMessage());
});
"message": "No query results for model [App\\Models\\Topic] 957",
"status_code": 404,
推荐文章: