49 words, 1 min read
⚠️ This post links to an external website. ⚠️
Laravel 12 introduces
withFiltered(), a cleaner way to filter eager-loaded relationships without using messy nested closures. It lets you apply conditions directly or use reusable filter methods defined in your model. This makes your Eloquent queries easier to read, maintain, and reuse—especially when loading related data like approved comments.
continue reading on laraveldailytips.com
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.