Use the withAggregate() method to add related values to Eloquent queries using subselects
💡 A little #Laravel tip from the latest blog post to get the week started!
Under the hood, the withAvg/withCount/withSum and other methods in Eloquent use the 'withAggregate' method. You can use this method to add a subselect based on a relationship 💫
#PHP #webdev #OpenSource