From 567320437fe714342efac34aa3f24e9617cd78de Mon Sep 17 00:00:00 2001 From: Muhammed Shafi P Date: Thu, 18 Jul 2024 11:32:21 +0530 Subject: [PATCH] Support html label for Header --- src/Header.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Header.php b/src/Header.php index fd14412..9b3bdb6 100644 --- a/src/Header.php +++ b/src/Header.php @@ -5,6 +5,7 @@ use Closure; use Filament\Support\Concerns\EvaluatesClosures; use Filament\Support\Enums\Alignment; +use Illuminate\Contracts\Support\Htmlable; use Illuminate\Support\Str; class Header @@ -13,7 +14,7 @@ class Header final public function __construct( public string $name, - public string | Closure | null $label = null, + public string | Htmlable | Closure | null $label = null, public string | Closure | Alignment | null $align = null, public string | Closure | null $width = null, public bool | Closure | null $isRequired = null, @@ -24,7 +25,7 @@ public static function make(string $name): static return app(static::class, ['name' => $name]); } - public function label(string | Closure $label): static + public function label(string | Htmlable | Closure $label): static { $this->label = $label; @@ -52,7 +53,7 @@ public function markAsRequired(bool | Closure | null $condition = true): static return $this; } - public function getLabel(): string + public function getLabel(): string | Htmlable { return $this->evaluate($this->label) ?? (string) Str::of($this->name)->title();