call to a member function relation() on null

Repeater::make('offers')
->relationship('offer_order')
->hiddenLabel()
->addActionLabel('Add Offer')
->orderColumn(false)
->reorderableWithDragAndDrop(false)
->schema([
//...fields
])
->itemLabel(fn (array $state): ?string => $state['offer_name'] ?? $name)
->collapsible(),


public function offer_order()
{
return $this->hasMany(OfferOrder::class);
}


schema of offer_order
order_id
offer_id (null able in case of custom offer)
name (in case of custom)
details (in case of custom)


why do i get call to a member function offer_order() on null

i have only added offer id field yet
but when i click on add offer on either create or edit page i get this error
Was this page helpful?