Answer the question
In order to leave comments, you need to log in
Laravel belongsTo via pivot table?
public function referralTo()
{
$isReferraled = UserReferral::where('referral_id', $this->id)->first()->inviter;
return $isReferraled;
}
Relationship method must return an object of type Illuminate\Database\Eloquent\Relations\Relation
Answer the question
In order to leave comments, you need to log in
"Relationship method must return an object of type Illuminate\Database\Eloquent\Relations\Relation"
Have you read this at all? Where do you have a relationship method in that code? In one single place: ->inviter.
Relationship method must RETURN - this is required from the method, and therefore from you. Where is the method? In the UserReferral model, where else could it be. Show the inviter method code from this model.
Is it really so difficult to follow what is required of you in plain text. Moreover, the 100% stacktrace even indicates a specific place, and with the new laravel 5.5 whoops, the code is also there ..
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question