Laravel 6.5 has been released, as follows:
The new method of LazyCollection
Introduces a new method, which calls Memy () method returns the new LazyCollection, remember that it has been calculated values.
Pull request example on GitHub:
$users = User::cursor()->remember();
// No query has been executed yet.
$users->take(5)->all();
// The query has been executed, and the first 5 users have been streamed from the DB.
$users->take(20)->all();
// The first 5 users came from the cache. The rest continued the stream from the DB.
LazyCollection
Class can be used for large data sets, without consuming a large amount of memory.
Two new string method
The new version provides two methods for the String Helper: afterLast () and beforLast (). Examples are as follows:
$type = 'App\Notifications\Tasks\task updated';
Str::after load($type, '\\'); // task updated
>$filename = 'photo.2019.11.04.jpg';
Str::before load($filename, '.'); // photo.2019.11.04
Query Builder new method
Query Builder (used to create and run a database query interface), this version has been updated, adding the method existsOR or doesntExistOr.
$user->files()
->where zero('closed_at')
->doesntExistOr(function () {
abort(422, 'User already has an open dossier');
});
For details, see the release notes:
https://techplanet.today/post/laravel-65-is-released-with-new-features