error with relationship
why i have this error. ( i really have no idea dd ) https://flareapp.io/share/x5MWyJwP
code: problem is with relationship
Flare
Filament\Support\Services\RelationshipJoiner::prepareQueryForNoConstraints(): Argument #1 ($relationship) must be of type Illuminate\Database\Eloquent\Relations\Relation, null given, called in /var/www/html/shesyidvebi/vendor/filament/forms/src/Components/Select.php on line 764 - The error occurred at http://127.0.0.1:8000/admin/purchases/5/edit
9 Replies
select is returning null... but it stats it needs to be a relation. so you should return: $query instead.
where i should return $query
can u write it ?
I am guessing:
same erorr
Filament\Support\Services\RelationshipJoiner::prepareQueryForNoConstraints(): Argument #1 ($relationship) must be of type Illuminate\Database\Eloquent\Relations\Relation, null given, called in /var/www/html/shesyidvebi/vendor/filament/forms/src/Components/Select.php on line 764
thanks means
i have problem in models right?
hm interesting
Could be, remove the function off for now. And if you get th esame error you need to review your model.
yep same error
hm
like when i add
Repeater::make('purchaseBrands')
->relationship() <#!----------- This
->schema([
Select::make('brand_id')
->label('Brand')
->relationship('brand', 'name', function (Builder $query, Get $get) {
if($get('../../supplier_id') === null) {
return $query;
}
$brandIds = Supplier::find($get('../../supplier_id'))->brand_id;
$query->whereIn('id', $brandIds);
})
->searchable()
->disableOptionsWhenSelectedInSiblingRepeaterItems()
->required()
->preload()
->createOptionForm([
TextInput::make('name')
->required()
->label('New Brand'),
TextInput::make('brand_amount')
->numeric()
->required()
]),
TextInput::make('amount')->required()
->required(),
])
->columns(2)
->addActionLabel('add blog')
->collapsible(),
this relationship which i mark
next i have this error
tats means i have error in modal purchaseBrand sright?
in purchaseBrands pivot i have this code
can u help me
what i should write to work ?
like i follow documentation info
i have purchases table and also purchases_transport table which is pivot
also transporter table where i have transporter names
fuck no
its about brands..
Solution
its my problem dd
i forgot..
sorry wait d
i made it thanks ❤️
Great.