Do you know Laravel have released version 9.47?

The Laravel team released 9.47 this week with new Eloquent collection visibility methods, “destroyable” singleton routes, support for lazy collections with the batch fake, and more。

Patrick Wan
2 min readJan 26, 2023
laravel-new-release

There have 3 new updates for Laravel version 9.46.

1. New Eloquent collection visibility methods

2. Support lazy collections in BatchFake

3. “Destroyable” singleton routes

Let’s get in more detail.

Jess Archer contributed setVisible and setHidden methods to Eloquent collections. The setVisible method is useful when you want to be explicit about the data you want to return, and it won't leak as new attributes are added to the model:

$users->setVisible(['id', 'name'])->toArray();
/*
[
[
'id' => 1,
'name' => 'Test User',
]
]
*/

The converse setHidden is useful if you only have a few fields that you want explicitly hidden but generally want values visible by default.

Support lazy collections in BatchFake

--

--

Patrick Wan
Patrick Wan

Written by Patrick Wan

My name’s Patrick. I’m a Software Developer, experience in Laravel, Vue Js, React Js, Livewire, Jquery, Codegniter, NPM, GIT. I have 5 years plus experience.

No responses yet