DEV Community

Morcos Gad
Morcos Gad

Posted on • Edited on

2 1

New Things Added - Laravel 9.21 Released

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

loadCount() - whenCounted()

class PostController
{
    public function show(Post $post)
    {
        return new PostResource($post->loadCount('comments'));
    }
}

class PostResource extends PostResource
{
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'comments_count' => $this->whenCounted('comments'),
        ];
    }
}
Enter fullscreen mode Exit fullscreen mode
$request->enum('status', StatusEnum::class);
Enter fullscreen mode Exit fullscreen mode
php artisan model:show User
Enter fullscreen mode Exit fullscreen mode
php artisan about
Enter fullscreen mode Exit fullscreen mode

https://laravel-news.com/customize-laravel-about-command

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://www.youtube.com/watch?v=Ilv7jYj2_GU
Source :- https://www.youtube.com/watch?v=JR42YZ9ZbNQ
Source :- https://www.youtube.com/watch?v=25Zg5MvXFUo
Source :- https://www.youtube.com/watch?v=PBBTgJwMUsk
Source :- https://laravel-news.com/laravel-9-21-0

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

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

Okay