Input Checkbox
This example enables Checkboxes in Table rows.
|
ID
|
Name
|
E-mail
|
---|---|---|---|
|
1
|
Test User
|
test@example.com
|
|
2
|
Luan
|
luanfreitasdev@fakemail.com
|
|
3
|
Daniel
|
dansysanalyst@fakemail.com
|
|
4
|
Claudio
|
claudio@fakemail.com
|
|
5
|
Vitor
|
vitao@fakemail.com
|
|
6
|
Tio Jobs
|
tiojobs@fakemail.com
|
Disclaimer: Table data is randomly generated for
illustrative purposes only. The information here is not a reflection of the actual market and does
not constitute business, financial, or medical advice.
<?php namespace App\Livewire\Examples\InputCheckboxTable; use App\Models\User;use Illuminate\Database\Eloquent\Builder;use Illuminate\Support\Carbon;use PowerComponents\LivewirePowerGrid\Column; use PowerComponents\LivewirePowerGrid\Facades\PowerGrid;use PowerComponents\LivewirePowerGrid\PowerGridComponent;use PowerComponents\LivewirePowerGrid\PowerGridFields; final class InputCheckboxTable extends PowerGridComponent{ public string $tableName = 'input-checkbox-table'; public function setUp(): array { $this->showCheckBox(); return [ PowerGrid::footer() ->showPerPage() ->showRecordCount(), ]; } public function datasource(): ?Builder { return User::query(); } public function fields(): PowerGridFields { return PowerGrid::fields() ->add('id') ->add('name') ->add('email') ->add('created_at_formatted', fn ($model) => Carbon::parse($model->created_at)->format('d/m/Y H:i:s')); } public function columns(): array { return [ Column::make('ID', 'id'), Column::make('Name', 'name') ->sortable() ->searchable(), Column::make('E-mail', 'email'), ]; }}
Code highlighting provided by Torchlight.dev