DEV Community

Morcos Gad
Morcos Gad

Posted on

New Things Added - Laravel 9.4 Released

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

  • Add soleValue method to query builders

new soleValue() method to query builders to return a column from the sole value instead of the whole record
https://github.com/laravel/framework/pull/41368

// bails if there is not exactly one result,
// but returns an object
$query->sole(['id']);

// returns just the value, but no safety around
// there being exactly one result
$query->value('id'); 

// To get the ID, we must do
$query->sole(['id'])->id;

// This update allows the following usage
// Bails if there is not exactly one result
// and returns just the value
$query->soleValue('id');
Enter fullscreen mode Exit fullscreen mode
Str::lcfirst('Laravel'); // laravel
Str::lcfirst('Laravel framework'); // laravel framework
Str::lcfirst('Мама'); // мама
Str::lcfirst('Мама мыла раму'); // мама мыла раму
Enter fullscreen mode Exit fullscreen mode
  • Add “Mutex” column to schedule:list command

Here’s an example of the output based outlined in the above issue

$ php artisan schedule:list
+----------------------------------------------------------+-------------+--------------------+----------------------------+----------------------------+
| Command                                                  | Interval    | Description        | Next Due                   | Has Mutex                  |
+----------------------------------------------------------+-------------+--------------------+----------------------------+----------------------------+
| '/usr/bin/php8.0' 'artisan' mycommands:something         | */2 * * * * | Process something  | 2022-03-03 10:22:00 +00:00 | Yes                        |
| '/usr/bin/php8.0' 'artisan' mycommands:otherthing        | */2 * * * * | Process otherthing | 2022-03-03 10:22:00 +00:00 |                            |
+----------------------------------------------------------+-------------+--------------------+----------------------------+----------------------------+
Enter fullscreen mode Exit fullscreen mode
  • Support for Modifying a char Column Type
Schema::table('users', function (Blueprint $table) {
    $table->char('name', 50)->nullable()->change();
});
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-4-0
Source :- https://www.youtube.com/watch?v=Fpo-5rL4_g4

Top comments (0)