Detail
Id
Name
Email
Created At
Action
Id
|
↕
Name
|
↕
Email
|
↕
Created At
|
Action
|
|
1
|
Luan
|
luanfreitasdev@fakemail.com
|
20/04/2024 01:59:57
|
|
---|---|---|---|---|---|
|
2
|
Daniel
|
dansysanalyst@fakemail.com
|
20/04/2024 01:59:57
|
|
|
3
|
Claudio
|
claudio@fakemail.com
|
20/04/2024 01:59:57
|
|
|
4
|
Vitor
|
vitao@fakemail.com
|
20/04/2024 01:59:57
|
|
|
5
|
Tio Jobs
|
tiojobs@fakemail.com
|
20/04/2024 01:59:57
|
|
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 use App\Models\User;use Illuminate\Database\Eloquent\Builder;use Illuminate\Support\Carbon;use PowerComponents\LivewirePowerGrid\Button;use PowerComponents\LivewirePowerGrid\Column;use PowerComponents\LivewirePowerGrid\Detail;use PowerComponents\LivewirePowerGrid\Facades\Rule;use PowerComponents\LivewirePowerGrid\Footer;use PowerComponents\LivewirePowerGrid\Header;use PowerComponents\LivewirePowerGrid\PowerGrid;use PowerComponents\LivewirePowerGrid\PowerGridComponent;use PowerComponents\LivewirePowerGrid\PowerGridFields; final class DetailTable extends PowerGridComponent{ public function setUp(): array { return [ Header::make() ->showToggleColumns() ->showSearchInput(), Footer::make() ->showPerPage() ->showRecordCount(), Detail::make() ->view('components.detail') ->params(['name' => 'Luan']) ->showCollapseIcon(), ]; } 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 (User $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('Email', 'email') ->sortable() ->searchable(), Column::make('Created At', 'created_at_formatted', 'created_at') ->searchable() ->sortable(), Column::action('Action'), ]; } public function actions(): array { return [ Button::add('detail') ->slot('Detail') ->class('bg-indigo-500 rounded-md cursor-pointer text-white px-3 py-2 m-1 text-sm') ->toggleDetail(), ]; } public function actionRules(): array { return [ Rule::rows() ->when(fn (User $user) => $user->id == 1) ->detailView('components.detail-rules', ['test' => 1]), ]; }}
Here you can find all relevant packages installed on this demo.
Name
|
Version
|
Description
|
---|---|---|
laravel/framework
|
v10
|
The Laravel Framework.
|
openspout/openspout
|
v4.23.0
|
PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way
|
power-components/livewire-powergrid
|
5.x-dev
|
PowerGrid generates Advanced Datatables using Laravel Livewire.
|