Using FilamentPHP v3 Repeater Fields for Variable-Length Form Entries
Decide when to store Filament Repeater data as JSON versus a child table, plus validation and Livewire performance limits.
10 Nov 2026, 22:12 UTC

The problem: variable-length entries in a single form
You need an admin form where users can add an unknown number of related rows—invoice line items, team members, or product specifications—before saving the parent record. A single text field cannot capture that structure, and building a separate child-table interface from scratch takes time.
Filament v3's Repeater field lets admins add, remove, and reorder nested rows inside one form. Livewire is the PHP library Filament uses to keep the browser and server form state in sync without writing custom JavaScript.
The useful takeaway: use a Repeater for small, self-contained sets stored as JSON. Move to a normalized child table when you need to query, sort, or attach files to individual rows.
This guide assumes Filament v3. Confirm your version by running this read-only command in your Laravel project root:
composer show filament/filament
Look for a version constraint starting with ^3. No special permissions are required because this only reads installed package metadata.
Store repeater data as JSON or in a child table
A JSON column keeps every repeater row in one database field, typically as an array of objects. It works well when the rows are display-only and you never need to search inside them.
A child table uses a hasMany relationship. Each repeater row becomes its own record. Choose this when you need to report on individual items, enforce foreign-key constraints, or attach files to specific rows.
If you add a JSON column, run the migration in your project root. You need write access to the database:
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('invoices', function (Blueprint $table) {
$table->json('line_items')->nullable();
});
}
public function down(): void
{
Schema::table('invoices', function (Blueprint $table) {
$table->dropColumn('line_items');
});
}
};
php artisan migrate
This changes database state. Roll back with php artisan migrate:rollback if you need to remove the column; dropping it deletes any data already stored there.
Validate nested inputs and expect Livewire round-trips
Every time a user adds, removes, or reorders a repeater row, the browser sends a Livewire request containing the full nested array. That keeps server-side form state synchronized, but large repeater sets increase payload size and can slow saves.
Use dot notation in your validation rules so Laravel targets each row correctly:
'line_items.*.sku' => ['required', 'string', 'max:255'],
'line_items.*.quantity' => ['required', 'integer', 'min:1'],
'line_items.*.price' => ['required', 'numeric', 'min:0'];
Drag-and-drop reordering does not auto-persist sort order. Add an explicit sort column to your child table or JSON structure, and update it during save if order matters.
Worked example: invoice line items
Add the Repeater to your Filament resource form schema. This example stores line items as JSON in the invoices table.
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\TextInput;
Repeater::make('line_items')
->schema([
TextInput::make('sku')->required(),
TextInput::make('quantity')->numeric()->required(),
TextInput::make('price')->numeric()->required(),
])
->columns(3)
->reorderable()
->collapsible(),
On the Invoice model, cast the column so PHP treats it as an array:
use Illuminate\Database\Eloquent\Casts\AsArrayObject;
protected $casts = [
'line_items' => AsArrayObject::class,
];
Submit sample data through the resource and inspect the invoices table. The line_items column should contain a JSON array matching the rows entered in the form.
Limitations and pre-deployment checks
- Payload size: the full nested array round-trips on every interaction. Test with the maximum expected number of rows.
- Sort order: reordering in the UI does not save unless you explicitly write a sort column.
- File uploads: files inside repeaters need temporary storage and cleanup logic if the parent record is rolled back.
- Nesting depth: deeply nested repeaters complicate validation messages and frontend rendering and are not officially recommended.
Before deploying, open your browser's developer tools, go to the Network tab, filter for Livewire requests, and add a repeater row. Confirm the request payload includes the full items array and that the response updates the form without errors. Then submit the form and verify the database row contains the expected JSON.
Actionable closing
Start with a JSON column and a simple Repeater if your rows are small and self-contained. If you find yourself querying individual line items, sorting them, or attaching files, move the data to a child table bound to a hasMany relationship. Verify with composer show filament/filament, a sample submission, and a Livewire payload check before rolling out to users.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.