Reputation: 1961
This never happened to me before
return $this->model->newQuery()
->where('canonical', true)
->groupBy('systemUrl')
->having('n', '>', 1)
->select('systemUrl', \DB::raw('count(*) as n'))
->pluck('systemUrl')->toArray();
This code produces the desired query, except it output an unexpected limit 1
.
How is that possible?
Upvotes: 0
Views: 84
Reputation: 1961
Problem was a missing get()
:
return $this->model->newQuery()
->where('canonical', true)
->groupBy('systemUrl')
->having('n', '>', 1)
->select('systemUrl', \DB::raw('count(*) as n'))
->get() // <--- this one
->pluck('systemUrl')->toArray();
Upvotes: 3