Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

voten/app/Traits/CachableChannel.php has group by error #339

Open
night1008 opened this issue Jul 5, 2018 · 0 comments
Open

voten/app/Traits/CachableChannel.php has group by error #339

night1008 opened this issue Jul 5, 2018 · 0 comments

Comments

@night1008
Copy link

night1008 commented Jul 5, 2018

Illuminate/Database/QueryException with message 'SQLSTATE[42803]: Grouping error: 7 ERROR: column "suggesteds.id" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: select "id", "channel_id" from "suggesteds" group by "channe... ^ (SQL: select "id", "channel_id" from "suggesteds" group by "channel_id")'

id caused from

public function getDefaultChannels()
 {
     return Cache::remember('default-channels-ids', 60 * 60 * 24, function () {
         return \App\Suggested::groupBy('channel_id')->select('id', 'channel_id')->pluck('channel_id');
     });
}

it should be

 \App\Suggested::groupBy('channel_id')->select('channel_id')->pluck('channel_id')

or

 \App\Suggested::distinct('channel_id')->select('channel_id')->pluck('channel_id')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant