1. Go to this page and download the library: Download linhntaim/advanced-fields library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
linhntaim / advanced-fields example snippets
use Filament\Schemas\Schema;
use LinhntAim\AdvancedFields\RadioGrid;
use LinhntAim\AdvancedFields\CheckboxGrid;
public function mount(): void
{
$this->form->fill([
// format of the state used for RadioGrid
'filled_radio_grid' => [
'row_1' => 'column_c',
'row_2' => 'column_b',
'row_3' => 'column_a',
],
// format of the state used for CheckboxGrid
'filled_checkbox_grid' => [
'row_1' => [
'column_c',
'column_a',
],
'row_2' => [
'column_b',
'column_c',
],
'row_3' => [
'column_a',
'column_b',
],
],
]);
}
public function form(Schema $schema): Schema
{
return $schema->components([
...,
RadioGrid::make('radio_grid')
->options([
'column_a' => 'Column A',
'column_b' => 'Column B',
'column_c' => 'Column C',
])
->rows([
'row_1' => 'Row 1',
'row_2' => 'Row 2',
'row_3' => 'Row 3',
])
// optionally, (one) radio must be checked in each row
->