Home  »  LibrariesNewsProgrammingSoftwareTechnologyTools   »   Laravel 9.46 Release with two JsonResource Methods now Available

Laravel 9.46 Release with two JsonResource Methods now Available

The latest Laravel 9.46 Release is now available with two JsonResource methods added. These allow developers to conditionally include resource properties. There are also updates to the decimal validation rule, and more improvements and fixes.

The whenHas() method has been added to the JsonResource. This gives users the ability to conditionally include attributes in a Response when an attribute is found on a model.

The unless() method has also been added and is used for retrieving a value if the condition resolves to false.

The above Laravel additions have been contributed by Michael Nabil. There is an update to the decimal validation rule that supports signed number while Artisan serve now passes the PATH variable which might be necessary to the underlying code to use to find executables.

You can check out some Laravel 9.46 release examples showing the above features on this announce page.

References:

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.