Skip to content

Commit

Permalink
Merge pull request #34 from intrepidws/extending_columns_multiple_par…
Browse files Browse the repository at this point in the history
…ameters

Allow multiple parameter methods when extending columns
  • Loading branch information
andreia authored Dec 12, 2024
2 parents f6d2eab + da92754 commit ddfc215
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,25 @@ After adding this information in the config, please run this command for changes
php artisan optimize
```

As things stand, methods with two required parameters are not supported.
Methods with two or more parameters can be specified with an array like so:

```php
<?php

return [

'audits_extend' => [
'created_at' => [
'class' => \Filament\Tables\Columns\TextColumn::class, // required
'methods' => [
'sortable',
'date' => ['Y-m-d H:i:s', 'America/New_York'],
],
],
]

];
```

### Custom View Data Formatting

Expand Down
2 changes: 1 addition & 1 deletion src/RelationManagers/AuditsRelationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function ($collection) use ($columnName) {
return $columnClass->$value();
}

return $columnClass->$key($value);
return $columnClass->$key(...Arr::wrap($value));
});

return $columnClass;
Expand Down

0 comments on commit ddfc215

Please sign in to comment.