Select component not saving relationship since 3.3.8

Because of this commit: https://github.com/filamentphp/filament/commit/e181afc9a6a424a4ddc0e68dfaa5c382c857c4af, my relationship is not saving anymore during a record creation. Model "Allocation" has a relationship "npis" on the table npis (npi.allocation_id) Models/Allocation.php
/**
* @return HasMany<Npi, $this>
*/
public function npis(): HasMany
{
return $this->hasMany(Npi::class);
}
/**
* @return HasMany<Npi, $this>
*/
public function npis(): HasMany
{
return $this->hasMany(Npi::class);
}
AllocationResource.php
Forms\Components\Select::make('npis')
->relationship(
name: 'npis',
modifyQueryUsing: function ($query, Get $get) {
$issuanceId = $get('issuance_id') ?? 0;

$query
->whereNull('allocation_id')
->where('issuance_id', $issuanceId);
}
)
->getOptionLabelFromRecordUsing(fn (Npi $record) => sprintf('%s %s', $record->client->name, Str::volume($record->volume)))
->searchable()
->live()
->preload()
->multiple()
->required(),
Forms\Components\Select::make('npis')
->relationship(
name: 'npis',
modifyQueryUsing: function ($query, Get $get) {
$issuanceId = $get('issuance_id') ?? 0;

$query
->whereNull('allocation_id')
->where('issuance_id', $issuanceId);
}
)
->getOptionLabelFromRecordUsing(fn (Npi $record) => sprintf('%s %s', $record->client->name, Str::volume($record->volume)))
->searchable()
->live()
->preload()
->multiple()
->required(),
Why has this feature been removed? Should I manually be associating the Npi's to the allocation? I can't seem to find this in the docs.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?