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..0298fea 100644 --- a/tests/Feature/AdminErrorPagesTest.php +++ b/tests/Feature/AdminErrorPagesTest.php @@ -96,3 +96,14 @@ 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'); +});