anourvalar/eloquent-serialize

Laravel 查询构建器(Eloquent)序列化

1.2.25 2024-09-16 12:59 UTC

README

支持:Laravel 6 - Laravel 11

安装

composer require anourvalar/eloquent-serialize

使用

序列化

$package = \EloquentSerialize::serialize(
    \App\User::query()
        ->with('userPhones')
        ->where('id', '>', '10')
        ->limit(20)
);

反序列化

$builder = \EloquentSerialize::unserialize($package);

foreach ($builder->get() as $item) {
    // ...
}