Forms\Components\Group::make()
->schema([
Forms\Components\Section::make()
->schema([
Forms\Components\Select::make('customer_id')
->relationship('customer', 'name', modifyQueryUsing: fn (Builder $query) => $query->whereBelongsTo(Filament::getTenant(), 'teams'))
->searchable()
->required()
->preload()
->live(onBlur: true)
->createOptionForm([
self::customerForm(),
])
->createOptionAction(function (Action $action) {
$action->mutateFormDataUsing(function ($data) {
$data['team_id'] = Filament::getTenant()->id;
return $data;
});
return $action
->modalHeading('Create customer')
->modalSubmitActionLabel('Create customer')
->modalWidth('7xl');
})
->native(false),
])
]),Filament v3, multi tenancy form select only show option related tenant
by
Tags:
Leave a Reply