Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Livewire Tables Laravel Package

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.

View on GitHub
Deep Wiki
Context7

title: Array Columns (beta) weight: 2

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(),

Empty Value

You may define the default/empty value using the "emptyValue" method

ArrayColumn::make('notes', 'name')
    ->emptyValue('Unknown'),

Wrapping the Output

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

flexCol

This adds either:

  • Tailwind: 'flex flex-col'
  • Bootstrap: 'd-flex d-flex-col'

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(),

flexRow

This adds either:

  • Tailwind: 'flex flex-row'
  • Bootstrap: 'd-flex d-flex-row'

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(),

Manually

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(),

See Also

Please also see the following for other available methods:

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport