problem with Repeater
I have problem with repeater. when im using just selection, filter works fine but when i use this same selection inside the repeater its not filter right. there is both code
Repeater::make('Brands')
->schema([
Select::make('brand_id')
->label('Brand')
->relationship('brand', 'name', function (Builder $query, Get $get) {
if($get('supplier_id') === null) {
return;
}
$brandIds = Supplier::find($get('supplier_id'))->brand_id;
$query->whereIn('id', $brandIds);
})
->createOptionForm([
TextInput::make('name')
->required()
->label('New Brand'),
]),
TextInput::make('amount')->required()
->required(),
])
->columns(2)
->collapsible(),Repeater::make('Brands')
->schema([
Select::make('brand_id')
->label('Brand')
->relationship('brand', 'name', function (Builder $query, Get $get) {
if($get('supplier_id') === null) {
return;
}
$brandIds = Supplier::find($get('supplier_id'))->brand_id;
$query->whereIn('id', $brandIds);
})
->createOptionForm([
TextInput::make('name')
->required()
->label('New Brand'),
]),
TextInput::make('amount')->required()
->required(),
])
->columns(2)
->collapsible(),Select::make('brand_id')
->label('Brand')
->relationship('brand', 'name', function (Builder $query, Get $get) {
if($get('supplier_id') === null) {
return;
}
$brandIds = Supplier::find($get('supplier_id'))->brand_id;
$query->whereIn('id', $brandIds);
})
->createOptionForm([
TextInput::make('name')
->required()
->label('New Brand'),
]),Select::make('brand_id')
->label('Brand')
->relationship('brand', 'name', function (Builder $query, Get $get) {
if($get('supplier_id') === null) {
return;
}
$brandIds = Supplier::find($get('supplier_id'))->brand_id;
$query->whereIn('id', $brandIds);
})
->createOptionForm([
TextInput::make('name')
->required()
->label('New Brand'),
]),