Workflow
Input Radiobutton

This example enables Radio Buttons 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\InputRadiobuttonTable;
 
use App\Models\User;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;
use PowerComponents\LivewirePowerGrid\Column;
use PowerComponents\LivewirePowerGrid\Footer;
use PowerComponents\LivewirePowerGrid\PowerGrid;
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
use PowerComponents\LivewirePowerGrid\PowerGridFields;
 
final class InputRadiobuttonTable extends PowerGridComponent
{
public function setUp(): array
{
$this->showRadioButton();
 
return [
 
Footer::make()
->showPerPage()
->showRecordCount(),
];
}
 
public function datasource(): ?Builder
{
return User::query();
}
 
public function fields(): PowerGridFields
{
return PowerGrid::fields()
->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

Here you can find all relevant packages installed on this demo.

Name
Version
Description
laravel/framework
v11
The Laravel Framework.
livewire/livewire
v3.4.12
A front-end framework for Laravel.
openspout/openspout
v4.24.0
PHP Library to read and write spreadsheet files (CSV, XLSX and ODS), in a fast and scalable way
power-components/livewire-powergrid
v5.6.3
PowerGrid generates Advanced Datatables using Laravel Livewire.