You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Account.php 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Filament\User\Clusters;
  3. use Filament\Clusters\Cluster;
  4. use Filament\Navigation\NavigationItem;
  5. class Account extends Cluster
  6. {
  7. protected static ?string $navigationIcon = 'heroicon-s-user';
  8. protected static ?string $navigationLabel = 'My Account';
  9. protected static ?string $clusterBreadcrumb = 'My Account';
  10. public static function getNavigationUrl(): string
  11. {
  12. return static::getUrl(panel: 'user');
  13. }
  14. public static function canAccess(): bool
  15. {
  16. return ! app()->environment('demo');
  17. }
  18. /**
  19. * @return array<NavigationItem>
  20. */
  21. public static function getNavigationItems(): array
  22. {
  23. return [
  24. NavigationItem::make(static::getNavigationLabel())
  25. ->visible(static::canAccess())
  26. ->group(static::getNavigationGroup())
  27. ->parentItem(static::getNavigationParentItem())
  28. ->icon(static::getNavigationIcon())
  29. ->activeIcon(static::getActiveNavigationIcon())
  30. ->isActiveWhen(fn (): bool => request()->routeIs(static::getNavigationItemActiveRoutePattern()))
  31. ->sort(static::getNavigationSort())
  32. ->badge(static::getNavigationBadge(), color: static::getNavigationBadgeColor())
  33. ->badgeTooltip(static::getNavigationBadgeTooltip())
  34. ->url(static::getNavigationUrl()),
  35. ];
  36. }
  37. }