PHP code example of asignua / filament-clusters

1. Go to this page and download the library: Download asignua/filament-clusters 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/ */

    

asignua / filament-clusters example snippets


use Asignua\FilamentClusters\ClustersPlugin;

$panel->plugin(ClustersPlugin::make());

use Asignua\FilamentClusters\Cluster;
use Filament\Forms\Components\TextInput;

Cluster::make([
    TextInput::make('first_name')->label('First name')->);

Cluster::make([...])->columns(4);                              // 4 equal columns on every screen
Cluster::make([...])->columns(['default' => 1, 'sm' => 2]);    // stacked on mobile
Cluster::make([...])->stackBelow('md');                        // one per line below md, a row from md up
Cluster::make([...])->columns(1);                              // a vertical cluster

// Money + currency
Cluster::make([
    Select::make('currency')->options(['EUR' => 'EUR', 'USD' => 'USD'])->native(false)->default('EUR'),
    TextInput::make('amount')->numeric()->minValue(0)->columnSpan(['default' => 3]),
])->label('Price')->columns(4);

// Range
Cluster::make([
    TextInput::make('min')->numeric()->prefix('from'),
    TextInput::make('max')->numeric()->prefix('to')->gte('min'),
])->label('Quantity');

// Address lines
Cluster::make([
    TextInput::make('street')->columnSpan(['default' => 1, 'sm' => 3]),
    TextInput::make('house')->columnSpan(['default' => 1, 'sm' => 1]),
    TextInput::make('zip'),
    TextInput::make('city')->columnSpan(['default' => 1, 'sm' => 3]),
])->label('Address')->columns(['default' => 1, 'sm' => 4]);

// Date + time
Cluster::make([DatePicker::make('day'), TimePicker::make('time')])->label('When')->stackBelow('sm');