rappasoft/laravel-livewire-tables
Laravel Livewire Tables provides dynamic, feature-rich data tables for Laravel Livewire with sorting, searching, filtering, pagination, bulk actions, and Bootstrap/Tailwind support. Build reusable table components backed by Eloquent queries.
Array columns provide an easy way to work with and display an array of data from a field.
ArrayColumn::make('notes', 'name')
->data(fn($value, $row) => ($row->notes))
->outputFormat(fn($index, $value) => "<a href='".$value->id."'>".$value->name."</a>")
->separator('<br />')
->sortable(),
You may define the default/empty value using the "emptyValue" method
ArrayColumn::make('notes', 'name')
->emptyValue('Unknown'),
As the ArrayColumn is designed to handle multiple related records, you can choose to wrap these for improved UX.
It is recommended that you utilise the built-in flexCol or flexRow approaches, which will also disable the separator
This adds either:
And merges any attributes specified in the sole parameter (as an array)
ArrayColumn::make('notes', 'name')
->data(fn($value, $row) => ($row->notes))
->outputFormat(fn($index, $value) => "<a href='".$value->id."'>".$value->name."</a>")
->flexCol(['class' => 'bg-red-500'])
->sortable(),
This adds either:
And merges any attributes specified in the sole parameter (as an array)
ArrayColumn::make('notes', 'name')
->data(fn($value, $row) => ($row->notes))
->outputFormat(fn($index, $value) => "<a href='".$value->id."'>".$value->name."</a>")
->flexRow(['class' => 'bg-red-500'])
->sortable(),
You can also specify a wrapperStart and wrapperEnd, for example, for an unordered list:
ArrayColumn::make('notes', 'name')
->data(fn($value, $row) => ($row->notes))
->outputFormat(fn($index, $value) => "<li><a href='".$value->id."'>".$value->name."</a></li>")
->wrapperStart("<ul class='bg-blue'>")
->wrapperEnd("</ul>")
->sortable(),
Please also see the following for other available methods:
How can I help you explore Laravel packages today?