-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rowData & columnData with Closure #16
Comments
how do you suggest to fix this? |
Copied from filament select options protected array | Arrayable | string | Closure $columnData = [];
public function columnData(array | Arrayable | string | Closure $data): static
{
$this->columnData = $data;
return $this;
}
public function getColumnData(): array
{
$columns = $this->evaluate($this->columnData) ?? [];
if (is_string($columns) && enum_exists($enum = $columns)) {
if (is_a($enum, LabelInterface::class, allow_string: true)) {
return array_reduce($enum::cases(), function (array $carry, LabelInterface & UnitEnum $case): array {
$carry[$case?->value ?? $case->name] = $case->getLabel() ?? $case->name;
return $carry;
}, []);
}
return array_reduce($enum::cases(), function (array $carry, UnitEnum $case): array {
$carry[$case?->value ?? $case->name] = $case->name;
return $carry;
}, []);
}
if ($columns instanceof Arrayable) {
$columns = $columns->toArray();
}
return $columns;
} |
great, if you test it and its working in your case, can you submit a PR thank you |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
rowData & columnData has supported closure but the function is not. Please update
The text was updated successfully, but these errors were encountered: