PHP code example of chenpkg / laravel-helpers

1. Go to this page and download the library: Download chenpkg/laravel-helpers library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

chenpkg / laravel-helpers example snippets


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
]);