PHP code example of zvizvi / relation-manager-repeater
1. Go to this page and download the library: Download zvizvi/relation-manager-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/ */
zvizvi / relation-manager-repeater example snippets
use Zvizvi\RelationManagerRepeater\Tables\RelationManagerRepeaterAction;
class PostsRelationManager extends RelationManager
{
protected static string $relationship = 'posts';
public function table(Table $table): Table
{
return $table
->columns([
//
])
->headerActions([
RelationManagerRepeaterAction::make(),
]);
}
}
use Filament\Forms\Components\Repeater;
public function table(Table $table): Table
{
return $table
->columns([
//
])
->headerActions([
RelationManagerRepeaterAction::make()
->modalWidth('5xl')
->modalHeading('Edit Related Records')
->configureRepeater(function (Repeater $repeater) {
return $repeater
->reorderable()
->collapsible()
->cloneable()
->defaultItems(0)
->maxItems(5);
}),
]);
}