- Creating Columns
- Relationships
- Available Methods
- Other Column Types
- Column Selection
- Secondary Header
- Footer
Getting Started
Usage
DataTable
Columns
Rows
Sorting
Pagination
Search
Bulk Actions
Filters
Reordering
Secondary Header
Footer
Examples
Misc.
🎉 Enjoying this package? Consider sponsoring me on GitHub or buying me a beer.
This is the documentation for v2. 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
Bulk Action Export
Here's an example on exporting your data from a bulk action using Laravel Excel:
use App\Exports\UsersExport;
use Maatwebsite\Excel\Facades\Excel;
public function bulkActions(): array
{
return [
'export' => 'Export',
];
}
public function export()
{
$users = $this->getSelected();
$this->clearSelected();
return Excel::download(new UsersExport($users), 'users.xlsx');
}
The UsersExport
class is a simple example of how to export data from a bulk action:
<?php
namespace App\Exports;
use App\Models\User;
use Maatwebsite\Excel\Concerns\FromCollection;
class UsersExport implements FromCollection
{
public $users;
public function __construct($users) {
$this->users = $users;
}
public function collection()
{
return User::whereIn('id', $this->users)->get();
}
}