Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- products
- id
- launch_date
- name
- product_view_history
- id
- account_id
- product_id
- timestamps
- $this->select('products.*', DB::raw('COUNT(product_view_history.id) as view_count'))
- ->leftJoin('product_view_history', 'product_view_history.product_id', '=', 'products.id', 'outer')
- ->groupBy('product_view_history.product_id')
- ->orderBy('view_count', 'DESC')
- ->orderBy('products.id', 'DESC')
- ->whereNotNull('products.launch_date')
- ->with(['owner.images', 'owner.star', 'owner.follows', 'owner.followers', 'company.products.alphas'])
- ->take(Config::get('xxxx.limits.small'))
- ->get();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement