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.

AppServiceProvider.php 2.0KB

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