laravel-sub-query
laravel-sub-query copied to clipboard
Laravel sum, min, max, avg columns in related model, sorting by relations and limit relations rows
Attempting to utilize orderByRelation('relationship:field')->paginate(25) `->orderByRelation([ 'relationship:column' => function ($query) use ($account_id) { $query->where('account_id', $account_id); }, 'desc' ]) ->paginate(25)` This works great on page 1, but as soon as I go...
Wouldn't it be nicer to do these calculations in PHP rather than tiring the MySQL? ```php /** * Find items for current year * @param string $column * @return $this...