blntgvn42
blntgvn42
FFilament
Created by blntgvn42 on 4/15/2024 in #❓┊help
Filament Multi Tenant app CreateOptionForm
Hello, I am developing my multi-tenant app and want to use quick add using createOptionForm. This below is my create option forms.
Select::make('department_id')
->relationship('department', 'name', fn (Builder $query) => $query->whereBelongsTo(Filament::getTenant()))
->native(false)
->required()
->createOptionForm([
TextInput::make('company_id')
->numeric()
->default(Filament::getTenant()->id),
TextInput::make('name')
->label('Department Name')
->required()
->columnSpanFull(),
]),
Select::make('title_id')
->relationship('title', 'name', fn (Builder $query) => $query->whereBelongsTo(Filament::getTenant()))
->native(false)
->required()
->createOptionForm([
TextInput::make('company_id')
->numeric()
->default(Filament::getTenant()->id),
TextInput::make('name')
->label('Title Name')
->required()
->columnSpanFull(),
]),
Select::make('department_id')
->relationship('department', 'name', fn (Builder $query) => $query->whereBelongsTo(Filament::getTenant()))
->native(false)
->required()
->createOptionForm([
TextInput::make('company_id')
->numeric()
->default(Filament::getTenant()->id),
TextInput::make('name')
->label('Department Name')
->required()
->columnSpanFull(),
]),
Select::make('title_id')
->relationship('title', 'name', fn (Builder $query) => $query->whereBelongsTo(Filament::getTenant()))
->native(false)
->required()
->createOptionForm([
TextInput::make('company_id')
->numeric()
->default(Filament::getTenant()->id),
TextInput::make('name')
->label('Title Name')
->required()
->columnSpanFull(),
]),
this works perfectly fine but I dont want to show the company_id field. When I also give property
->visible(false)
->visible(false)
it throws me error that company_id constraint cannot be null. Can you point me to the right direction? Thanks a lot in advance
8 replies