📜  以块 laravel 从模型中获取数据 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:02.105000             🧑  作者: Mango

代码示例1
$data = Inspector::latest('id')
    ->select('id', 'firstname', 'status', 'state', 'phone')
    ->where('firstname', 'LIKE', '%' . $searchtext . '%')
    ->chunk(50, function($inspectors) {
        foreach ($inspectors as $inspector) {
            // apply some action to the chunked results here
        }
    });