DEV Community

Morcos Gad
Morcos Gad

Posted on • Edited on

6 3

New Things Added - Laravel 9.16 Released

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

method that simplifies cases where you have to repeat code used to both filter with whereHas and select the same record via with()

CollectionModel::whereHas('products', function ($query) {
    $query->where('enabled', true)->where('sale', true);
})->with(['products' => function ($query) {
    $query->where('enabled', true)->where('sale', true);
});
Enter fullscreen mode Exit fullscreen mode

Using the withWhereHas method, you can simplify your code around this use case

CollectionModel::withWhereHas('products', fn ($query) => $query->where('enabled', true)->where('sale', true));
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-16-0
Source :- https://www.youtube.com/watch?v=ZEDUihpRQMM

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

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