PHP code example of lastdragon-ru / lara-asp-eloquent
1. Go to this page and download the library: Download lastdragon-ru/lara-asp-eloquent 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/ */
lastdragon-ru / lara-asp-eloquent example snippets
$query = \App\Models\User::query();
$query->chunk(100, function ($users) {
foreach ($users as $user) {
// ...
}
});
foreach ($query->getChunkedIterator() as $user) {
// ...
}
$query = \App\Models\User::query()->offset(10)->limit(20);
foreach ($query->getChunkedIterator() as $user) {
// ... 20 items from 10
}
foreach ($query->getChunkedIterator()->setOffset(0) as $user) {
// ...20 items from 0
}
$query = \App\Models\User::query();
foreach ($query->getChangeSafeIterator() as $user) {
// ...
}