fix unit tests as well as missing code
API CI/CD / Validate (composer + pint) (push) Successful in 2m7s
API CI/CD / Test (PHPUnit) (push) Failing after 2m23s
API CI/CD / Build frontend assets (push) Successful in 2m18s
API CI/CD / Security audit (push) Successful in 31s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
API CI/CD / Validate (composer + pint) (push) Successful in 2m7s
API CI/CD / Test (PHPUnit) (push) Failing after 2m23s
API CI/CD / Build frontend assets (push) Successful in 2m18s
API CI/CD / Security audit (push) Successful in 31s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
This commit is contained in:
@@ -80,4 +80,22 @@ return Application::configure(basePath: dirname(__DIR__))
|
||||
return response()->json(['message' => 'Unauthorized.'], 401);
|
||||
}
|
||||
});
|
||||
|
||||
$exceptions->render(function (\Illuminate\Auth\Access\AuthorizationException $e, Request $request) {
|
||||
if ($request->is('api/*') || $request->expectsJson()) {
|
||||
return response()->json(['message' => $e->getMessage() ?: 'Forbidden.'], 403);
|
||||
}
|
||||
});
|
||||
|
||||
$exceptions->render(function (\Symfony\Component\HttpKernel\Exception\HttpExceptionInterface $e, Request $request) {
|
||||
if ($request->is('api/*') || $request->expectsJson()) {
|
||||
return response()->json(['message' => $e->getMessage() ?: 'Request failed.'], $e->getStatusCode());
|
||||
}
|
||||
});
|
||||
|
||||
$exceptions->render(function (\TypeError $e, Request $request) {
|
||||
if ($request->is('api/*') || $request->expectsJson()) {
|
||||
return response()->json(['message' => 'Resource not found.'], 404);
|
||||
}
|
||||
});
|
||||
})->create();
|
||||
|
||||
Reference in New Issue
Block a user