Skip to content

Commit

Permalink
Release v0.5.1 (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
gael-connan-cybex authored Jul 19, 2024
2 parents 44d5c15 + fba709c commit 0b018d0
Show file tree
Hide file tree
Showing 3 changed files with 951 additions and 1,051 deletions.
62 changes: 0 additions & 62 deletions app/Exceptions/Handler.php

This file was deleted.

11 changes: 10 additions & 1 deletion bootstrap/app.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Support\Facades\Route;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

return Application::configure(basePath: dirname(__DIR__))
->withRouting(
Expand All @@ -22,5 +24,12 @@
//
})
->withExceptions(function (Exceptions $exceptions) {
//
$exceptions->render(function (NotFoundHttpException $e, \Illuminate\Http\Request $request) {
if ($request->wantsJson() && $e->getPrevious() instanceof ModelNotFoundException) {
return response()->json([
'message' =>
sprintf('Requested %s couldn\'t be found.', class_basename($e->getPrevious()->getModel())),
], 404);
}
});
})->create();
Loading

0 comments on commit 0b018d0

Please sign in to comment.