Skip to content

Commit 1a2aa02

Browse files
committed
Support relationship fields for all attributes
1 parent b88cadf commit 1a2aa02

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/Concerns/CardFormattingTrait.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ protected function formatCardForDisplay(Model $model): array
2727

2828
$card = [
2929
'id' => $model->getKey(),
30-
'title' => $model->{$titleField},
31-
'column' => $model->{$columnField},
30+
'title' => data_get($model, $titleField),
31+
'column' => data_get($model, $columnField),
3232
];
3333

34-
if ($descriptionField !== null && isset($model->{$descriptionField})) {
35-
$card['description'] = $model->{$descriptionField};
34+
if ($descriptionField !== null) {
35+
$card['description'] = data_get($model, $descriptionField);
3636
}
3737

3838
foreach ($cardAttributes as $key => $label) {
3939
$field = is_string($key) ? $key : $label;
4040
$card['attributes'][$field] = [
4141
'label' => is_string($key) ? $label : $field,
42-
'value' => $model->{$field},
42+
'value' => data_get($model, $field),
4343
];
4444
}
4545

src/Livewire/KanbanBoard.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Filament\Forms\Contracts\HasForms;
1212
use Filament\Notifications\Notification;
1313
use Illuminate\Support\Collection;
14-
use Illuminate\Support\Facades\Gate;
1514
use Illuminate\View\View;
1615
use Livewire\Attributes\Locked;
1716
use Livewire\Component;

0 commit comments

Comments
 (0)