Skip to content

Commit bd71c2d

Browse files
authored
Allow dot notation for customer attributes
I'd like to propose allowing the use of dot notation for accessing nested attributes via relationships when using custom attributes. Eg: For a table of posts, instead of adding an accessor attribute to the Post model `getAuthorFullNameAttribute()`, using dot notation, you can simply access the authors full_name attribute directly, through the relationship: ``` Column::make(__('Author'), 'author.full_name') ->customAttribute() ->searchable() ->sortable(), ``` Thanks for this awesome package. Truly is a pleasure.
1 parent 6d3c5d7 commit bd71c2d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

resources/views/includes/_body.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class="{{ $this->setTableDataClass($column->attribute, Arr::get($model->toArray(
5353
@endif
5454
@else
5555
@if ($column->isCustomAttribute())
56-
{{ $model->{$column->attribute} }}
56+
{{ data_get($model, $column->attribute) }}
5757
@else
5858
{{ Arr::get($model->toArray(), $column->attribute) }}
5959
@endif

0 commit comments

Comments
 (0)