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);
}
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server