Hide Input Form inside Repeater based on condition
Hello,
I want to hide a select input if the line record exist, (Order has many items), I'm trying this code :
Repeater::make('lines')
->relationship()
->schema([
...
Forms\Components\Select::make('product_id')
->relationship('product', 'name')
->visible(fn(?Model $record) => !$record)
...
But I get this error :
Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization
Is there a way to manage this ? thanks3 Replies
Try like this https://filamentphp.com/docs/3.x/forms/advanced#dependant-select-options put
live()
on lines, and control visibility using $getAlready set it, but the problem is when repeater is empty, otherwise it works fine if items already exist
Not really understand what you meant, but you could also check like if repeater not empty or smth