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.
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.