laravel helpers.
- Scope 模型查询作用域构建
- Batch 模型批量修改
- Tree 模型无限极分类树
- MetaPaginator 模型分页自定义添加数据
$ composer require chenpkg/laravel-helpers
功能来源于 laravelBatch
use LaravelHelpers\Support\Batch;
$update = [
[
'id' => 1,
'name' => '李四'
],
[
'id' => 5,
'name' => '小红'
],
[
'id' => 5,
'name' => '李雷雷'
]
];
Batch::update(new User(), $update, 'id');
// 分页添加自定义数据
$result = User::where('age', '>', 18)->metaPaginate();
$result->addMeta('count', 1)->addMeta('total', 1000);
// or
$result->setMeta([
'count' => 1,
'total' => 1000
]);
MIT