This week, the Laravel team released v11.2, which includes a fluent() support helper, a context() helper, improved handling of a missing database duri

Use the New Fluent Helper to Work With Multi-dimensional Arrays in Laravel 11.2

submited by
Style Pass
2024-04-03 15:00:08

This week, the Laravel team released v11.2, which includes a fluent() support helper, a context() helper, improved handling of a missing database during a migrate operation, and more.

Philo Hermans contributed a fluent() helper function when working with multi-dimensional arrays. The Fluent class has been in the Laravel framework for quite a while; however, this PR introduces a helper convenience method to create a fluent object instance:

Michael Nabil contributed a convenience context() helper function for managing Context. Depending on the arguments passed, you can either add to context, get the context object, or retrieve it (with an optional custom default):

Dries Vints contributed better database failure handing (#50836) when running migrate when a database isn't created yet, as well as updating the migrate:fresh command to streamline the process when a database does not exist #50838:

If the migrate:fresh command is called while there isn't any database created yet, it'll fail when it tries to wipe the database. This PR fixes this by first checking if the migrations table exists and if not, immediately go to the migrate command by skipping the db:wipe command. This will invoke the migrate command flow and subsequently will reach the point where the command will ask the user to create the database.

Leave a Comment