Laravel 6.11 released with a firstWhere eloquent builder method.
1 min readJan 22, 2020
Laravel v6.11.0 was released in 14 Jan 2020 with a new eloquent method firstWhere and other fixes and other changes in 6.x branch.
firstWhere() method
This is a shortcut of where()->first() and contributed by the Caleb Porzio. (31089). This new method is only available in the eloquent builder.
// Before
User::where('username', 'foo')->first();//After
User::firstWhere('username', 'foo');
Added
- Added Illuminate\Database\Eloquent\Builder::firstWhere() method (#31089)
- Redis Broadcaster: Broadcast to multiple channels at once (#31108)
Fixed
- Fixed undefined property in WithFaker::makeFaker() (#31083)
- Fixed Str::afterLast() method (#31095)
- Fixed insert float into MySQL with PHP 7.3 (#31100)
- Fixed refresh on Model with customized pivot attribute name (#31125, 678b26b)
Changed
- Remove all indentation in blade templates (917ee51)
- Added mailable names to assertion messages in MailFake::assertNothingSent() and MailFake::assertNothingQueued() (#31106)
- Search for similar results in assertDatabaseHas() (#31042, 2103eb7)
The full release note for Laravel 6.11 is available in the GitHub. Check here.