PHP code example of thiktak / filament-nested-builder-form

1. Go to this page and download the library: Download thiktak/filament-nested-builder-form 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/ */

    

thiktak / filament-nested-builder-form example snippets



use Thiktak\FilamentNestedBuilderForm\Forms\Components\NestedBuilder;
use Thiktak\FilamentNestedBuilderForm\Forms\Components\NestedSubBuilder;
// ...

        NestedBuilder::make('array_configuration')
            // Add configuration to Builder & sub-builder
            ->nestedConfiguration(function (NestedSubBuilder $builder) {
                // Apply only for the root level
                $builder->blockNumbers($builder->getLevel() == 1);

                // Apply for all others levels
                $builder->columnSpanFull(); // full width
            })

            // Replace schema() by nestedSchema
            ->nestedSchema(function (NestedSubBuilder $builder) { // Closure is mandatory
                return [
                    Block::make('group')
                        ->schema([
                            Select::make('title')
                                ->

use Thiktak\FilamentNestedBuilderForm\Forms\Components\NestedBuilder;
use Thiktak\FilamentNestedBuilderForm\Forms\Components\NestedSubBuilder;
// ...

        NestedBuilder::make('array_configuration')
            ->nestedConfiguration(function (NestedSubBuilder $builder) {
                $builder->blockNumbers($builder->getLevel() == 1);
                $builder->columnSpanFull(); // full width
            })
            ->nestedSchema(function (NestedSubBuilder $builder) {
                return [
                    Block::make('group')
                        ->label(sprintf('Group (%s)', $builder->getLevel()))
                        ->schema([
                            Select::make('condition')
                                ->options(['and' => 'AND', 'or' => 'OR'])
                                ->default('and')
                                ->

use Thiktak\FilamentNestedBuilderForm\Forms\Components\NestedBuilder;
use Thiktak\FilamentNestedBuilderForm\Forms\Components\NestedSubBuilder;
// ...

    public static function form(Form $form): Form
    {
        $nested = function ($builder) {
            return [
                Block::make('group')
                    ->schema([
                        Select::make('condition')
                            ->options(['and' => 'AND', 'or' => 'OR'])
                            ->default('and')
                            ->                  ->default('=')
                            ->
schema(Closure | array)