DEV Community

Morcos Gad
Morcos Gad

Posted on • Edited on

New Things Added - Laravel 9.24 , 9.25 Released

Let's get started quickly I found new things in Laravel 9.24 , 9.25 Released I wanted to share with you.

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

db:monitor command lets you see things like the number of connections to the database

php artisan db:monitor
Enter fullscreen mode Exit fullscreen mode

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());
Enter fullscreen mode Exit fullscreen mode

Image description

<x-icon @class(['lg' => $large]) />
Enter fullscreen mode Exit fullscreen mode

restoreQuietly() method that restores a soft-deleted model without raising any events

$deletedModel->restoreQuietly();
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
})
Enter fullscreen mode Exit fullscreen mode
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...!';
    }));
Enter fullscreen mode Exit fullscreen mode
$touched = User::find(1)->touch();
$touched = User::query()->touch();
$touched = User::where('email', 'like', '%@company.com')->touch();

$published = Post::query()->touch('published_at');
Enter fullscreen mode Exit fullscreen mode
php artisan db:table hello_world
//  Table hello_world doesn't exist. 
Enter fullscreen mode Exit fullscreen mode

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)