I have the following code:
Province::query()
->with(['cities' => function ($query) {
$query->take(10);
}])
->get()
However, this just adds a LIMIT 10 to the end of the relationships query. Resulting in a total of 10 cities over all the provinces. How would I make it so I get 10 cities per province?
I've stumbled upon this package, but I'd rather not use a package for something this 'simple': https://github.com/staudenmeir/eloquent-eager-limit