Form with nested repeaters with relation

Hello, I am building service order application and now trying to create this form for a while with no success and it is frustrating me.

Background:
Customer brings his Bike 1 (ServiceAsset) and wants to perform one or more ServiceType. Customer can bring more ServiceAssets to be serviced.

In other words we have ServiceOrder model, which is ->belongsTo() Customer model. Customer has ->hasMany() ServiceAssets models related.
ServiceOrder ->hasMany() ServiceOrderItems which ->belongsTo() ServiceAsset and also ->belongsTo() ServiceType

My ideal form is something like on the picture, so I started with this:
https://gist.github.com/hypertractor/bc17c554a19fd9012fe33e1b53870829

So, I get the Bike 1 box, with Select over Customers assets and my ServiceType Select
->options(fn ($get): Collection => ServiceAsset::query()
  ->where('customer_id', $get('../../customer_id'))
  ->pluck('name', 'id')
)

I choose a bike, then ServiceType.
I can add another ServiceType or even ServiceAseet (Repeater::make('items')), but I cannot store it as i get:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'items_repeater' in 'field list'
which is correct, as it obviously does not exist.
I was trying to play around with model relations but problem is that nested repeater.

Has anyone idea how to create such form?
Thank you!
IMG_20231101_152551.jpg
Gist
Laravel Filament 3 nested Repeater. GitHub Gist: instantly share code, notes, and snippets.
Was this page helpful?