Skip to content

Commit

Permalink
improve type safety and cs
Browse files Browse the repository at this point in the history
  • Loading branch information
danharrin committed Feb 2, 2025
1 parent e9b5b9a commit 57a5b51
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/panels/src/FilamentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ public function getWidgets(): array
{
return $this->getCurrentOrDefaultPanel()->getWidgets();
}

public function hasBreadcrumbs(): bool
{
return $this->getCurrentOrDefaultPanel()->hasBreadcrumbs();
Expand Down
14 changes: 12 additions & 2 deletions packages/panels/src/Panel/Concerns/HasNotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Closure;
use Filament\Livewire\DatabaseNotifications;
use Livewire\Component;

trait HasNotifications
{
Expand All @@ -15,6 +16,9 @@ trait HasNotifications

protected string | Closure | null $databaseNotificationsPolling = '30s';

/**
* @param class-string<Component> | Closure | null $livewireComponent
*/
public function databaseNotifications(bool | Closure $condition = true, string | Closure | null $livewireComponent = null, bool | Closure $isLazy = true): static
{
$this->hasDatabaseNotifications = $condition;
Expand All @@ -24,9 +28,12 @@ public function databaseNotifications(bool | Closure $condition = true, string |
return $this;
}

public function databaseNotificationsLivewireComponent(string | Closure | null $livewireComponent): static
/**
* @param class-string<Component> | Closure | null $component
*/
public function databaseNotificationsLivewireComponent(string | Closure | null $component): static
{
$this->databaseNotificationsLivewireComponent = $livewireComponent;
$this->databaseNotificationsLivewireComponent = $component;

return $this;
}
Expand Down Expand Up @@ -55,6 +62,9 @@ public function hasLazyLoadedDatabaseNotifications(): bool
return (bool) $this->evaluate($this->hasLazyLoadedDatabaseNotifications);
}

/**
* @return class-string<Component>
*/
public function getDatabaseNotificationsLivewireComponent(): string
{
return $this->evaluate($this->databaseNotificationsLivewireComponent) ?? DatabaseNotifications::class;
Expand Down

0 comments on commit 57a5b51

Please sign in to comment.