DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 964,423 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
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

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.