When retrieving records from the database, sometimes we may require fetching those categories which has product, and this can be achieved by simply. Let's suppose: One to Many relationships between category and products. One to Many relationships between product and feedbacks. $categories = Category::has('products')->get(); But what if we are supposed to retrieve those categories that has product with feedbacks.

Note: You should method named products to define hasMany() relation for product in Category Model and feedbacks method to define hasMany() relation for feedbacks.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners