Supports: 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) {
// ...
}