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.

Users.php 875B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace App\Filament\Pages;
  3. use Filament\Pages\Page;
  4. use Illuminate\Support\Facades\Auth;
  5. use Wallo\FilamentCompanies\FilamentCompanies;
  6. class Users extends Page
  7. {
  8. protected static ?string $navigationIcon = 'heroicon-o-user-group';
  9. protected static string $view = 'filament.pages.users';
  10. protected static function shouldRegisterNavigation(): bool
  11. {
  12. return Auth::user()->currentCompany->name === 'ERPSAAS';
  13. }
  14. public function mount(): void
  15. {
  16. abort_unless(Auth::user()->currentCompany->name === 'ERPSAAS', 403);
  17. }
  18. protected function getHeaderWidgets(): array
  19. {
  20. return [
  21. Widgets\CumulativeUserData::class,
  22. Widgets\Users::class,
  23. ];
  24. }
  25. protected static function getNavigationBadge(): ?string
  26. {
  27. return FilamentCompanies::userModel()::count();
  28. }
  29. }