New Things Added - Laravel 9.24 , 9.25 Released
Tags: laravel, php, webdev, programming
Published: 2022-08-12 11:18:00

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
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
php artisan db:table users
```
db:monitor command lets you see things like the number of connections to the database
```php
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
```php
// 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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cr0bl2gehu0qyjshzxg6.png)

-  Add whenNull to ConditionallyLoadsAtrribute trait
https://github.com/laravel/framework/pull/43600

- Allow @class() for component tags
https://github.com/laravel/framework/pull/43140
```php
<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
```php
$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
```php
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

```php
str('test')->exactly('test'); // true

str('test')->whenExactly('test', function () {
  dd('OK'); // OK
})

str('test')->whenNotExactly('Test', function () {
  dd('OK'); // OK
})
```
```php
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
```php
$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
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