PHP code example of icetalker / filament-table-repeater

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

    

icetalker / filament-table-repeater example snippets


use Icetalker\FilamentTableRepeater\Forms\Components\TableRepeater;

protected function form(Form $form): Form
{
    return $form->schema([
        ...
        TableRepeater::make('items')
                ->relationship('items')
                ->schema([
                    Forms\Components\TextInput::make('product'),
                    ...
                ])
                ->reorderable()
                ->cloneable()
                ->collapsible()
                ->minItems(3)
                ->maxItems(5)
                ->columnSpan('full'),

    ]);
}

use Icetalker\FilamentTableRepeater\Forms\Components\TableRepeater;

protected function form(Form $form): Form
{
    return $form->schema([
        ...
        Forms\Components\Grid::make(1)->schema([

            TableRepeater::make('items')
                ->relationship('items')
                ->schema([
                    Forms\Components\TextInput::make('product'),
                    Forms\Components\TextInput::make('quantity'),
                    ...
                ])
                ->colStyles([
                    'product' => 'color: #0000ff; width: 250px;',
                ]),

        ]),

    ]);
}

use Icetalker\FilamentTableRepeater\Forms\Components\TableRepeater;

protected function form(Form $form): Form
{
    return $form
        ->schema([
            ...
            Forms\Components\Grid::make(1)->schema([

                TableRepeater::make('items')
                    ->relationship('items')
                    ->schema([
                        Forms\Components\TextInput::make('product'),
                        Forms\Components\TextInput::make('quantity'),
                        ...
                    ])
                    ->colStyles(function(){
                        return [
                            'product' => 'color: #0000ff; width: 250px;',
                        ]
                    }),

            ]),

        ]);
}
bash
php artisan vendor:publish --tag="filament-table-repeater"