Can I render a custom 403 page within the context of a panel?

The default 403 is a bit jarring to look at when you are navigating around a panel.Is there a way I can render a 403 within the context of a panel? I basically just want the panel layout, or even just the panels custom theme CSS to be available in errors/403.blade.php. I tried using a panel components like <x-filament-panels:layout.base> but they are all are missing their class methods / context.
2 Replies
S. Mert ÖZTÜRK
S. Mert ÖZTÜRK11mo ago
Because this component is a dependent component. You can not use directly. Basicly you want 403 page but with left and top layout. It's basic solution but you can try this; - CTRL + u and copy all content, - Clear inside of <main> tag and replace your 403 style (and clear wire tags) - Additional you can use links static or for resource page access with this; CustomerResource::getUrl(); But it can be causes some problems if you use spa
johncarter
johncarterOP11mo ago
Thanks! I ended up doing publishing the laravel errors layout (resources/views/errors/minimal.blade.php), which is an okay solution:
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>@yield('title')</title>

@filamentStyles

{{ filament()->getTheme()->getHtml() }}
{{ filament()->getFontHtml() }}

<style>
:root {
--font-family: '{!! filament()->getFontFamily() !!}';
}
</style>

</head>

<body class="bg-gray-50 lg:items-center flex justify-center min-h-screen p-6 font-sans antialiased">
<x-filament::section class="w-full max-w-md">
<div class="space-y-8 text-center">
<div class="space-y-4">
<x-filament::section.heading class="!text-3xl">
@yield('code') <span class="font-normal"> @yield('message')</span>
</x-filament::section.heading>
<p class="text-sm">Sorry — we've encountered an error.</p>
</div>

<div><x-filament::link icon="heroicon-o-arrow-uturn-left" iconSize="sm" type="button" :href="filament()->getHomeUrl()">Back to the dashboard</x-filament::link></div>
</div>
</x-filament::section>
</body>

</html>
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>@yield('title')</title>

@filamentStyles

{{ filament()->getTheme()->getHtml() }}
{{ filament()->getFontHtml() }}

<style>
:root {
--font-family: '{!! filament()->getFontFamily() !!}';
}
</style>

</head>

<body class="bg-gray-50 lg:items-center flex justify-center min-h-screen p-6 font-sans antialiased">
<x-filament::section class="w-full max-w-md">
<div class="space-y-8 text-center">
<div class="space-y-4">
<x-filament::section.heading class="!text-3xl">
@yield('code') <span class="font-normal"> @yield('message')</span>
</x-filament::section.heading>
<p class="text-sm">Sorry — we've encountered an error.</p>
</div>

<div><x-filament::link icon="heroicon-o-arrow-uturn-left" iconSize="sm" type="button" :href="filament()->getHomeUrl()">Back to the dashboard</x-filament::link></div>
</div>
</x-filament::section>
</body>

</html>

Did you find this page helpful?