From f242de7522748bf7306450228e630aa67bca08a3 Mon Sep 17 00:00:00 2001 From: Yurij Finiv Date: Sat, 10 Oct 2026 22:07:19 +0300 Subject: [PATCH 1/2] Render individual admin error views directly instead of nested dispatcher --- src/Exceptions/AdminErrorPages.php | 2 +- tests/Feature/AdminErrorPagesTest.php | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Exceptions/AdminErrorPages.php b/src/Exceptions/AdminErrorPages.php index c10dd84..6b19e01 100644 --- a/src/Exceptions/AdminErrorPages.php +++ b/src/Exceptions/AdminErrorPages.php @@ -30,7 +30,7 @@ public function __invoke(Throwable $exception, Request $request): ?Response $useAdminLayout = in_array($status, [403, 404], true) && Auth::guard($guard)->check(); try { - return response()->view('lazy::errors.page', [ + return response()->view('lazy::errors.'.$status, [ 'status' => $status, 'useAdminLayout' => $useAdminLayout, 'homeUrl' => url('/'.trim((string) config('lazy.admin.route.prefix', 'admin'), '/')), diff --git a/tests/Feature/AdminErrorPagesTest.php b/tests/Feature/AdminErrorPagesTest.php index 67981bf..a47bdb0 100644 --- a/tests/Feature/AdminErrorPagesTest.php +++ b/tests/Feature/AdminErrorPagesTest.php @@ -96,3 +96,15 @@ expect(__('lazy-admin::errors.404.title'))->toBe('Сторінку не знайдено') ->and(__('lazy-admin::errors.back_to_dashboard'))->toBe('До панелі керування'); }); + + +it('renders the individual 404 view directly with the real admin shell', function (): void { + $user = new class extends User {}; + $user->id = 456; + $this->be($user); + + $response = (new AdminErrorPages)(new HttpException(404), Request::create('/admin/missing')); + + expect($response?->getStatusCode())->toBe(404) + ->and($response?->getContent())->toContain('data-lazy-admin-shell'); +}); From 3ea3b5b9938abf472e5c4864847e4567ae2b6f11 Mon Sep 17 00:00:00 2001 From: CrazyBoy49z <3448603+CrazyBoy49z@users.noreply.github.com> Date: Sat, 10 Oct 2026 19:07:38 +0000 Subject: [PATCH 2/2] Fix styling --- tests/Feature/AdminErrorPagesTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Feature/AdminErrorPagesTest.php b/tests/Feature/AdminErrorPagesTest.php index a47bdb0..0298fea 100644 --- a/tests/Feature/AdminErrorPagesTest.php +++ b/tests/Feature/AdminErrorPagesTest.php @@ -97,7 +97,6 @@ ->and(__('lazy-admin::errors.back_to_dashboard'))->toBe('До панелі керування'); }); - it('renders the individual 404 view directly with the real admin shell', function (): void { $user = new class extends User {}; $user->id = 456;