Yash Pal
Yash Pal
FFilament
Created by Yash Pal on 3/29/2024 in #❓┊help
Error "Call to a member function newQueryWithoutRelationships() on null" on belongTo select field.
MembershipResource.php
Forms\Components\Select::make('club')
->live()

->required()
->searchable()
->label('Club')
->relationship(modifyQueryUsing: fn (Builder $builder) => $builder->whereNull('deleted_at'))
->afterStateUpdated(function (Forms\Set $set) {
$set('plan_id', null);
$set('membership_type', null);
})
Forms\Components\Select::make('club')
->live()

->required()
->searchable()
->label('Club')
->relationship(modifyQueryUsing: fn (Builder $builder) => $builder->whereNull('deleted_at'))
->afterStateUpdated(function (Forms\Set $set) {
$set('plan_id', null);
$set('membership_type', null);
})
Membership.php
public function club(): BelongsTo
{
return $this->belongsTo(Club::class);
}
public function club(): BelongsTo
{
return $this->belongsTo(Club::class);
}
1 replies