次のようにLaravel 6.5がリリースされました:
LazyCollectionの新しい方法
MEMY()メソッドを呼び出して、新しい方法、新発売LazyCollectionを返し、それが値を計算したことを覚えておいてください。
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
クラスは、大量のメモリを消費することなく、大規模なデータセットのために使用することができます。
二つの新しい文字列メソッド
afterLastの()とbeforLast():新しいバージョン文字列ヘルパーの2つの方法を提供します。例としては、次のとおりです:
$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
クエリー・ビルダーの新しい方法
クエリビルダ(データベースクエリインターフェイスを作成し、実行するために使用される)、このバージョンでは、メソッドexistsORまたはdoesntExistOrを追加し、更新されています。
$user->files()
->where zero('closed_at')
->doesntExistOr(function () {
abort(422, 'User already has an open dossier');
});
詳細については、リリースノートを参照してください。
https://techplanet.today/post/laravel-65-is-released-with-new-features