- Creating Columns
- Relationships
- Available Methods
- Other Column Types
- Column Selection
- Secondary Header
- Footer
- Reusable Columns
- Anonymous Columns
- Styling
- Standard Column
- Array Columns (beta)
- Avg Columns (beta)
- Boolean Columns
- Button Group Columns
- Color Columns
- Component Columns
- Count Columns (beta)
- Date Columns
- Icon Columns (beta)
- Image Columns
- Increment Column (beta)
- Link Columns
- Livewire Component (beta)
- Sum Columns (beta)
- View Component Columns
- Wire Link Column (beta)
- Introduction
- Creating Filters
- Applying Filters
- Available Methods
- Available Component Methods
- Available Filter Methods
- Introduction
- Boolean Filters (beta)
- Date Filters
- DateRange Filters
- DateTime Filters
- Multi-Select Dropdown Filters
- Multi-Select Filters
- NumberRange Filters
- Number Filters
- Select Filters
- Text Filters
- Livewire Custom Filter (Beta)
- Refreshing
- Loading Placeholder
- Multiple Tables Same Page
- Actions (beta)
- Adding Custom Markup
- Debugging
- Saving Table State
- Lifecycle Hooks
- Hiding The Table (beta)
- One Of Many Example
- Tools
Getting Started
Usage
DataTable
Columns
Column Types
Rows
Sorting
Pagination
Search
Bulk Actions
Filters
Filter Types
Reordering
Secondary Header
Footer
Examples
Misc.
Sponsored
Advanced Usage
Examples
🎉 Enjoying this package? Consider sponsoring me on GitHub or buying me a beer.
This is the documentation for v3. You can switch versions in the menu on the left/at the top. Check your current version with the following command:
composer show rappasoft/laravel-livewire-tables
Relationships
Out of the box the columns support hasOne
, belongsTo
, and MorphOne
relationships for display, sorting, and searching. The component will automatically join the necessary tables.
To call these relationships, just use the relationship dot-notation string as the field name:
1protected $model = User::class; 2 3// ... 4 5public function columns(): array { 6 return [ 7 // Looks for the address column on the address relationship of User. 8 // $user->address->address 9 Column::make('Address', 'address.address'),10 11 // Looks for $user->address->group->name12 Column::make('Address Group', 'address.group.name'),13 14 // Looks for $user->address->group->city->name15 Column::make('Group City', 'address.group.city.name'),16 ];17}
The above will join the necessary tables as well as alias the columns for selecting, sorting, searching, etc.:
1SELECT `addresses`.`address` AS `address.address`, 2 `address_groups`.`name` AS `address.group.name`, 3 `cities`.`name` AS `address.group.city.name` 4FROM `users` 5 LEFT JOIN `addresses` 6 ON `addresses`.`user_id` = `users`.`id` 7 LEFT JOIN `address_groups` 8 ON `addresses`.`address_group_id` = `address_groups`.`id` 9 LEFT JOIN `cities`10 ON `address_groups`.`city_id` = `cities`.`id`