My Blog Posts

Laravel 8.13 Out

Laravel 8.13 Out


The Laravel team released 8.13 this week and updated the change log detailing all new features from 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 a Custom Observer

@StefanoDucciConvenia , make:observercommand ( # 34911 ) contributed to the ability to use stub.

8.12: 8.x Lazy Method in 8.x Eloquent Factory

Mathieu TUDISCO continue a model in the database when it is called made you contributed to the ability to create a call back. In earlier versions of Laravel, factorybuilder's lazy()there was a method that created the record only when it was called. Now the 8.x factory can do the same:

$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 collection functions, such as MinMaxSumAvgOn relationships, etc.:

Post::withCount('comments');
Post::withMax('comments', 'created_at');
Post::withMin('comments', 'created_at');
Post::withSum('comments', 'foo');
Post::withAvg('comments', 'foo');

You may want to check out #34965 for more details.

8.12: Add a Description to Eloquent / Query Builder

Illia Sakovichexplain() contributed to the query builder/ meaningful constructor in a way that allows you to import the comment query from the constructor:

Webhook::where('event', 'users.registered')->explain()Webhook::where('event', 'users.registered')->explain()->dd()

Now explain()to check in the description dd()you can search and leave the description.

8.12: Full PHP 8 Support

Dries Vints is working to add PHP 8 support to the Laravel ecosystem, including coordinating various libraries (both first and third-party libraries) and many efforts. Thanks to Dries and anyone interested in preparing Laravel for the next major PHP release!

8.12: Route Registration Method

Gregori Piñeres has contributed to some methods that you can add to route parameters:

// Before. This is still a valid, acceptable way of defining routes
Route::get('authors/{author}/{book}')
->where([
'author' => '[0-9]+',
'book' => '[a-zA-Z]+'
]);
// New optional syntax
Route::get('authors/{author}/{book}')
->whereNumber('author')
->whereAlpha('book');
// New methods support multiple args
Route::get('authors/{author}/{book}')
->whereAlpha('author', 'book');

Release notes

Below is a complete list of new features and updates on GitHub and you can see the difference between 8.11.0 and 8.12.0 and 8.12.0 and 8.13.0. farkı görebilirsiniz 



Share this article


Comments (0)

Comment