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
4 Replies
Dennis Koch
Dennis Koch16h ago
Please put some effor in formatting your code ( #✅┊rules )
why do i get call to a member function offer_order() on null
The error says relation() on null. Where is this Repeater used? On an create/edit resource page on inside the panel?
lolmaheen
lolmaheenOP16h ago
i am using this on custom component and relation manager form i have resolved this error by defining the model but when i click on add offer no fields show up ->model(Model::class)
Dennis Koch
Dennis Koch16h ago
Any errors in console? What's the schema like?
lolmaheen
lolmaheenOP16h ago
thankyou resolved the issue the relatiosnhip was conflicting with another relation

Did you find this page helpful?