Skip to content

Instantly share code, notes, and snippets.

@cygeorgel
Last active December 18, 2018 09:39
Show Gist options
  • Save cygeorgel/d3d61cabfa75407fe87ae5ae0a89ab7f to your computer and use it in GitHub Desktop.
Save cygeorgel/d3d61cabfa75407fe87ae5ae0a89ab7f to your computer and use it in GitHub Desktop.
$customers_ids = \DB::table('tasks')
->selectRaw('DISTINCT customer_id')
->where('status_id', '>', '2')
->where('status_id', '<', '6')
->pluck('customer_id')
->toArray();
$customers = Customer::whereIn('id', $customers_ids)->get();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment