DEV Community 👩‍💻👨‍💻

Morcos Gad
Morcos Gad

Posted on • Updated on

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

Oldest comments (0)

All DEV content is created by the community!

Hey, if you're landing here for the first time, you should know that this website is a global community of folks who blog about their experiences to help folks like you out.

Sign up now if you're curious. It's free!