Let's get started quickly I found new things in Laravel 9.24 , 9.25 Released I wanted to share with you.
- New database artisan commands https://github.com/laravel/framework/pull/43367
new Artisan commands for databases: db:show, db:table, and db:monitor
db:show gives you an overview of the database. It includes things like DB type, DB size, version, username, and more
php artisan db:show
db:table command lets you see details about a table, including the number of rows, column details, indexes, and more
php artisan db:table users
db:monitor command lets you see things like the number of connections to the database
php artisan db:monitor
- Added validation doesnt_end_with rule https://github.com/laravel/framework/pull/43518
doesnt_end_with validation rule to check if a string doesn't end with a given substring. Here's an example from the pull request tests
// Validation passes
$v = new Validator(
$trans,
['x' => 'hello world'],
['x' => 'doesnt_end_with:hello']
);
$this->assertTrue($v->passes());
// Validation fails
$v = new Validator(
$trans,
['x' => 'hello world'],
['x' => 'doesnt_end_with:world']
);
$this->assertFalse($v->passes());
- Add mergeUnless to resource ConditionallyLoadsAttributes trait https://github.com/laravel/framework/pull/43567
Add whenNull to ConditionallyLoadsAtrribute trait
https://github.com/laravel/framework/pull/43600Allow @class() for component tags
https://github.com/laravel/framework/pull/43140
<x-icon @class(['lg' => $large]) />
- Add restoreQuietly functionality https://github.com/laravel/framework/pull/43550
restoreQuietly() method that restores a soft-deleted model without raising any events
$deletedModel->restoreQuietly();
- Make Config repository macroable https://github.com/laravel/framework/pull/43598
adding the macroable trait to the Config repository so users can extend it in their apps
config()->macro('sayHello', function () {
return 'Hello, world';
});
config()->sayHello(); // Hello, world
- Add whenNotExactly to Stringable https://github.com/laravel/framework/pull/43700
whenNotExactly string method that will execute a given callback if the string is not an exact match with the given value
str('test')->exactly('test'); // true
str('test')->whenExactly('test', function () {
dd('OK'); // OK
})
str('test')->whenNotExactly('Test', function () {
dd('OK'); // OK
})
use Illuminate\Support\Str;
// Returns `Iron Man`
Str::of('Tony')
->whenNotExactly('Tony Stark', function ($stringable) {
return 'Iron Man';
}));
// Provide an optional default value if `false`
// Returns `Swing and a miss...!`
Str::of('Tony Stark')
->whenNotExactly('Tony Stark', function ($stringable) {
return 'Iron Man';
}, function ($stringable) {
return 'Swing and a miss...!';
}));
- Add ability to Model::query()->touch() to mass update timestamps https://github.com/laravel/framework/pull/43665 https://www.youtube.com/watch?v=243NrYTRYvo
$touched = User::find(1)->touch();
$touched = User::query()->touch();
$touched = User::where('email', 'like', '%@company.com')->touch();
$published = Post::query()->touch('published_at');
- db:table command properly handle table who doesn't exist https://github.com/laravel/framework/pull/43669
php artisan db:table hello_world
// Table hello_world doesn't exist.
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-24-0
Source :- https://www.youtube.com/watch?v=LjL4AM-xALU
Source :- https://www.youtube.com/watch?v=ZOmV8BRMyNI
Source :- https://laravel-news.com/laravel-9-25-0
Source :- https://www.youtube.com/watch?v=EgdU0NJ5qu4
Top comments (0)