Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Users.php 821B

123456789101112131415161718192021222324252627282930313233343536
  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->id === 1;
  13. }
  14. public function mount(): void
  15. {
  16. abort_unless(Auth::user()->currentCompany->id === 1, 403);
  17. }
  18. protected function getHeaderWidgets(): array
  19. {
  20. return [
  21. Widgets\Users\Tables\Users::class,
  22. ];
  23. }
  24. protected static function getNavigationBadge(): ?string
  25. {
  26. return FilamentCompanies::userModel()::count();
  27. }
  28. }