The Laravel team released 8.13 this week and updated the change log detailing all the new features in last week's 8.12 release. New features added to Laravel in recent weeks have come with exciting updates, let's look at what's new!
8.12: Create Custom Observer
8.12: 8.x Lazy Method in 8.x Eloquent Factory
Mathieu TUDISCO continue a model in the database when called the one who made me contributed to the ability to generate a callback. In earlier versions of Laravel, factorybuilder
lazy()there was only one method that created the record when it was called. Now the 8.x factory can do the same thing:
$factory = User::factory()->lazy();
$factory = User::factory()->lazy(['name' => 'Example User']); $factory();
8.12: Encrypted String Eloquent Cast
Jason McCreary contributed to a meaningful cast that would allow a simple string to be encrypted and decrypted:
public $casts = [
'access_token' => 'encrypted',
8.12: New withColumn () to support Aggregation Functions
Halil Laleh a contribution
withColumna method to support more SQL aggregation functions, such as
Avgon relationships, etc.:
You might want to check out #34965 for more details.
8.12: Add a Description to Eloquent / Query Builder
explain() contributed to the query builder / meaningful constructor in a way that allows you to get the comment query from the constructor:
Webhook::where('event', 'users.registered')->explain()Webhook::where('event', 'users.registered')->explain()->dd()
explain()to check in the description
dd()and stop explaining.
8.12: Full PHP 8 Support
Dries Vints is working to add PHP 8 support to the Laravel ecosystem, including various libraries (both first and third-party libraries) and coordination of many efforts. Thanks to Dries and everyone interested in preparing Laravel for the next major PHP release!
8.12: Route Registration Method
Gregori Piñeres contributed to some methods that you can add to the route parameters:
// Before. This is still a valid, acceptable way of defining routes
'author' => '[0-9]+',
'book' => '[a-zA-Z]+'
]);// New optional syntax
->whereAlpha('book');// New methods support multiple args