mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
fix: Merge action arguments without overwriting
This commit is contained in:
@@ -29,12 +29,19 @@ trait HasArguments
|
||||
/**
|
||||
* @param array<string, mixed> $arguments
|
||||
*/
|
||||
public function mergeArguments(array $arguments): static
|
||||
public function mergeArguments(array $arguments, bool $shouldOverwriteExistingArguments = true): static
|
||||
{
|
||||
$this->arguments = [
|
||||
...$this->arguments ?? [],
|
||||
...$arguments,
|
||||
];
|
||||
if ($shouldOverwriteExistingArguments) {
|
||||
$this->arguments = [
|
||||
...$this->arguments ?? [],
|
||||
...$arguments,
|
||||
];
|
||||
} else {
|
||||
$this->arguments = [
|
||||
...$arguments,
|
||||
...$this->arguments ?? [],
|
||||
];
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -495,7 +495,7 @@ trait InteractsWithActions
|
||||
continue;
|
||||
}
|
||||
|
||||
$resolvedAction->mergeArguments($action['arguments'] ?? []);
|
||||
$resolvedAction->mergeArguments($action['arguments'] ?? [], shouldOverwriteExistingArguments: false);
|
||||
$resolvedAction->nestingIndex($actionNestingIndex);
|
||||
$resolvedAction->boot();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user