DEV Community

Morcos Gad
Morcos Gad

Posted on • Edited on

3 1

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

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay