1 week ago

HasOne create duplicates on eager loading

Posted 1 week ago by Theo1

I used hasOne relationship and which returns latest meeting of the group and I eager loaded that relationship in my collection but and laravel debugbar show's that there is duplicate queries caused by has one relationship

last meeting relationship

      public function lastMeeting()
        return $this->hasOne(Meeting::class)->latest();


 $groups = Cache::remember('groups', 60, function () use ($q) {
            return Group::filter(request()->all())

Any thought on what might be the reason on hasOne relationship

Please sign in or create an account to participate in this conversation.