Hey, i'm doing a query in which i want to select all models with a column value smaller than their relationship count.
In my account model i have the following relationship:
public function subscribers()
{
return $this->hasMany(Subscriber::class);
}
And in my account model i have a column named max_subscribers. I want to get all accounts, which column value "max_subscribers" is smaller than the count of the amount of subscribers an account has by the relationship - to see if the account has more subscribers than it is allowed to have.
How do i achieve this?
Thanks
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community