Laravel Livewire Tables Documentation

🎉 Enjoying this package? Consider sponsoring me on GitHub or buying me a beer.

This is the documentation for v1 but the latest version is v3. You can switch versions in the menu at the top. Check your current version with the following command:

composer show rappasoft/laravel-livewire-tables

Built-in cell formatting

If you are not using a custom row view, the cells will auto-format themselves.

I.e. If you are not using rowView() in your table, the component will attempt to display the cell contents by just getting the value from the model.

Note: If you know you are going to need more customization that the column formatter can support from the start, I would skip the column formatter and use a Custom Row View.

The following documentation is if you want to overwrite that default formatting functionality:

If you would like to format the cell inline:

1Column::make('Created On')
2 ->sortable()
3 ->format(function($value) {
4 return timezone()->convertToLocal($value);
5 }),

Note: If you need more control, the full parameter list for the format callback is $value, $column, $row.

If you would like to render HTML from the format method, you may call asHtml on the column.

1Column::make('Created On')
2 ->sortable()
3 ->format(function($value) {
4 return '<strong>'.timezone()->convertToLocal($value).'</strong>';
5 })
6 ->asHtml(),

You could also return a view:

1Column::make('Name')
2 ->sortable()
3 ->format(function($value, $column, $row) {
4 return view('admin.user.actions')->withUser($row);
5 }),

Be sure to check out the Custom Row View page to see how you can have full control over your row.