Relationship from query?

Posted 1 month ago by DerManoMann

Hi there,

I've got this model method that I would like to convert into a proper relationship. Is that possible? Basically I want to convert the query into a HasOne...

    public function bestOffer()
    {
        return $this->hasMany(Offer::class)->orderBy('amount, 'desc')->limit(1);
    }

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