Skip to content

Commit e81dc7e

Browse files
committed
fix: custom 404 page not showing
1 parent 8a8b874 commit e81dc7e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎bootstrap/app.php‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
use Illuminate\Foundation\Configuration\Middleware;
88
use Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets;
99
use Illuminate\Http\Request;
10+
use Inertia\Inertia;
1011
use Spatie\Permission\Exceptions\UnauthorizedException;
1112
use Spatie\Permission\Middleware\PermissionMiddleware;
1213
use Spatie\Permission\Middleware\RoleMiddleware;
1314
use Spatie\Permission\Middleware\RoleOrPermissionMiddleware;
15+
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
1416

1517
return Application::configure(basePath: dirname(__DIR__))
1618
->withRouting(
@@ -42,6 +44,10 @@
4244
->with('error', 'You do not have permission to perform this action.');
4345
});
4446

47+
$exceptions->render(function (NotFoundHttpException $e) {
48+
return Inertia::render('Error');
49+
});
50+
4551
$exceptions->shouldRenderJsonWhen(
4652
fn(Request $request) => $request->is('api/*'),
4753
);

0 commit comments

Comments
 (0)