您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

AppServiceProvider.php 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace App\Providers;
  3. use App\Contracts\AccountHandler;
  4. use App\Services\AccountService;
  5. use BezhanSalleh\PanelSwitch\PanelSwitch;
  6. use Filament\Notifications\Livewire\Notifications;
  7. use Filament\Support\Assets\Js;
  8. use Filament\Support\Enums\Alignment;
  9. use Filament\Support\Facades\FilamentAsset;
  10. use Illuminate\Support\ServiceProvider;
  11. class AppServiceProvider extends ServiceProvider
  12. {
  13. /**
  14. * All of the container bindings that should be registered.
  15. */
  16. public array $bindings = [
  17. AccountHandler::class => AccountService::class,
  18. ];
  19. /**
  20. * Register any application services.
  21. */
  22. public function register(): void
  23. {
  24. //
  25. }
  26. /**
  27. * Bootstrap any application services.
  28. */
  29. public function boot(): void
  30. {
  31. Notifications::alignment(Alignment::Center);
  32. $this->configurePanelSwitch();
  33. FilamentAsset::register([
  34. Js::make('TopNavigation', __DIR__ . '/../../resources/js/TopNavigation.js'),
  35. ]);
  36. }
  37. /**
  38. * Configure the panel switch.
  39. */
  40. protected function configurePanelSwitch(): void
  41. {
  42. PanelSwitch::configureUsing(function (PanelSwitch $panelSwitch) {
  43. $panelSwitch
  44. ->modalHeading('Switch Panel')
  45. ->modalWidth('md')
  46. ->slideOver()
  47. ->excludes(['admin'])
  48. ->iconSize(16)
  49. ->icons(function () {
  50. if (auth()->user()?->belongsToCompany(auth()->user()?->currentCompany)) {
  51. return [
  52. 'user' => 'heroicon-o-user',
  53. 'company' => 'heroicon-o-building-office',
  54. ];
  55. }
  56. return [
  57. 'user' => 'heroicon-o-user',
  58. 'company' => 'icon-building-add',
  59. ];
  60. });
  61. });
  62. }
  63. }