Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. products
  2. id
  3. launch_date
  4. name
  5.  
  6. product_view_history
  7. id
  8. account_id
  9. product_id
  10. timestamps
  11.  
  12. $this->select('products.*', DB::raw('COUNT(product_view_history.id) as view_count'))
  13. ->leftJoin('product_view_history', 'product_view_history.product_id', '=', 'products.id', 'outer')
  14. ->groupBy('product_view_history.product_id')
  15. ->orderBy('view_count', 'DESC')
  16. ->orderBy('products.id', 'DESC')
  17. ->whereNotNull('products.launch_date')
  18. ->with(['owner.images', 'owner.star', 'owner.follows', 'owner.followers', 'company.products.alphas'])
  19. ->take(Config::get('xxxx.limits.small'))
  20. ->get();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement