Let's get started quickly I found new things in Laravel 9.14 Released I wanted to share with you.
- Migration table comments for MySQL and Postgres https://github.com/laravel/framework/pull/42401
the ability to add table comments for MySQL and Postgres migrations
Schema::table('posts', function (Blueprint $table) {
$table->comment('This is a comment');
});
- Dynamic "trashed" factory state https://github.com/laravel/framework/pull/42414
dynamic support of a "trashed" factory state for models using soft deletes
// in Factory class
public function trashed()
{
return $this->state([
'deleted_at' => now()->subDay(),
]);
}
- Array prependKeysWith() helper https://github.com/laravel/framework/pull/42448
new array helper to prepend all key names in an associative array quickly
Arr::prependKeysWith(['key' => 'value'], 'prefix.');
// ['prefix.key' => 'value']
- Adds ability to have paginate() $perPage parameter as callable with access to $total
https://github.com/laravel/framework/pull/42429
// Previously:
$total = DB::table('products')->count();
DB::table('products')->paginate( $total <= 110 ? 110 : 100 );
// Now (saves extra query and builder code):
DB::table('products')->paginate(function ($total) {
return $total <= 110 ? 110 : 100;
});
I hope you enjoyed with me and to learn more about this release visit the sources and search more. I adore you who search for everything new.
Source :- https://laravel-news.com/laravel-9-14-0
Source :- https://www.youtube.com/watch?v=OC3K69wuCKE
Top comments (0)