Skip to content

Commit b1a8226

Browse files
committed
wip
1 parent 1cc14d7 commit b1a8226

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/Fields/URL.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function text(Closure|string $value): static
4646
/**
4747
* Set the download attribute.
4848
*/
49-
public function download(string $filename = ''): static
49+
public function download(string|Closure $filename = ''): static
5050
{
5151
$this->linkAttributes['download'] = $filename;
5252

@@ -56,7 +56,7 @@ public function download(string $filename = ''): static
5656
/**
5757
* Set the target attribute.
5858
*/
59-
public function target(string $target): static
59+
public function target(string|Closure $target): static
6060
{
6161
$this->linkAttributes['target'] = $target;
6262

@@ -66,7 +66,7 @@ public function target(string $target): static
6666
/**
6767
* Set the rel attribute.
6868
*/
69-
public function rel(string $rel): mixed
69+
public function rel(string|Closure $rel): mixed
7070
{
7171
$this->linkAttributes['rel'] = $rel;
7272

@@ -92,7 +92,12 @@ public function resolveFormat(Request $request, Model $model): ?string
9292
]);
9393

9494
$attributes = array_map(
95-
fn (?string $value, string $key): string => sprintf('%s="%s"', $key, $value),
95+
static function (string|Closure|null $attribute, string $name) use ($request, $model, $value): string {
96+
return match (true) {
97+
$attribute instanceof Closure => call_user_func_array($attribute, [$request, $model, $value]),
98+
default => sprintf('%s="%s"', $name, (string) $attribute),
99+
};
100+
},
96101
array_values($attributes),
97102
array_keys($attributes)
98103
);

src/Root.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Root
2727
*
2828
* @var string
2929
*/
30-
public const string VERSION = '2.7.4';
30+
public const string VERSION = '2.7.5';
3131

3232
/**
3333
* The registered booting callbacks.

0 commit comments

Comments
 (0)