繁体   English   中英

如何在Laravel中查询生成器的块

[英]How To Get Chunk To Query Builder In Laravel

我的Database大记录如何在此查询中写入Chunk

$users = DB::table('products')->orderBy($sortbysql, $sortbysqltype)
  -> where('product_name', 'like', '%' . $keyword . '%')
  -> where('product_status', '=','1')
  -> paginate($view);

$querylistbrand = DB::table('products')->select('product_brand_name',     DB::raw('count(*) as total')) 
   -> where('product_name', 'like', '%' . $keyword . '%') 
   -> where('product_status', '=','1')
   -> groupBy('product_brand_name')`enter code here`
   -> orderBy('total', 'desc')->take(25)->get();

在这种情况下,没有必要块的结果,因为他们已经被分块的方法paginatetake

对于这两种方法,您只需提供一定数量的将被检索的记录:

$results = $query->paginate(15);
$results = $query->take(15)->get();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM