feat: add navigation items for Preview and Live sites in AdminPanelProvider (#21)
Co-authored-by: jon brookes <marshyon@gmail.com> Reviewed-on: https://codeberg.org/headshed/share-lt/pulls/21
This commit is contained in:
parent
b6b841391c
commit
64a7d1d2f4
2 changed files with 21 additions and 1 deletions
|
|
@ -25,6 +25,25 @@ class AdminPanelProvider extends PanelProvider
|
|||
{
|
||||
public function panel(Panel $panel): Panel
|
||||
{
|
||||
$previewSiteUrl = env('PREVIEW_SITE_URL');
|
||||
$liveSiteUrl = env('LIVE_SITE_URL');
|
||||
|
||||
$navigationItems = [];
|
||||
if ($previewSiteUrl && $liveSiteUrl) {
|
||||
$navigationItems = [
|
||||
\Filament\Navigation\NavigationItem::make('Preview Site')
|
||||
->url($previewSiteUrl, shouldOpenInNewTab: true)
|
||||
->icon('heroicon-o-eye')
|
||||
->group('External Links')
|
||||
->sort(1),
|
||||
\Filament\Navigation\NavigationItem::make('Live Site')
|
||||
->url($liveSiteUrl, shouldOpenInNewTab: true)
|
||||
->icon('heroicon-o-rocket-launch')
|
||||
->group('External Links')
|
||||
->sort(2),
|
||||
];
|
||||
}
|
||||
|
||||
return $panel
|
||||
->default()
|
||||
->sidebarCollapsibleOnDesktop()
|
||||
|
|
@ -49,6 +68,7 @@ class AdminPanelProvider extends PanelProvider
|
|||
AccountWidget::class,
|
||||
FilamentInfoWidget::class,
|
||||
])
|
||||
->navigationItems($navigationItems)
|
||||
->middleware([
|
||||
EncryptCookies::class,
|
||||
AddQueuedCookiesToResponse::class,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue