Skip to content
This repository has been archived by the owner on Jul 7, 2021. It is now read-only.

Doesn't work with "withCount" #10

Closed
seqond-soft opened this issue Jun 18, 2021 · 1 comment
Closed

Doesn't work with "withCount" #10

seqond-soft opened this issue Jun 18, 2021 · 1 comment

Comments

@seqond-soft
Copy link

Hello!
Laravel 5.8
In this case it does not work.

pays its a hasManyThrough relation.

 $orders->withCount(['pays as pay_sum' => function (Builder $q) {
                        return $q->select(DB::raw('SUM(invoice_pays.sum)'));
                    }])->havingRaw('pay_sum >= `orders`.`amount`');

Column not found: 1054 Unknown column 'orders.amount' in 'having clause'

But of course such a column exists. Everything works well without pagination.

@royduin
Copy link
Member

royduin commented Jun 18, 2021

5.8 is EOL, just upgrade and remove this package from your application ;)

@royduin royduin closed this as completed Jun 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants