laravel-trend
laravel-trend copied to clipboard
Problem with "kirschbaum-development/eloquent-power-joins" package
Hi, I have notice when using eloquent-power-joins
can cause query problem.
So, eloquent-power-joins
is using scope to simplify join
query between relations, please take a look at this particular line of codes. If you notice, it will check if query has select
, if not it will add SELECT *
to query.
Since laravel-trend
's aggregate
method using selectRaw
, the code I've shown (line 40) will return false, and add SELECT *
to query, it cause problem since laravel-trend
using groupBy
to find aggregate columns.
I have solution for this problem by replacing this with this:
->select([
DB::raw("{$this->getSqlDate()} as date"),
DB::raw("{$aggregate}({$column}) as aggregate"),
])
I am sorry for my bad english, I hope you all can understand what I am trying to say. Thank you !
Info: Laravel 9, MySQL