'Laravel Relational Table if record exist
I want to select only the products that have a record in the relational table in the selectbox.
For example I just want to get product name which is product_id in the monthly_records table
Tables;
Products(ID, product_name)
Suppliers(ID, supplier_name)
monthly_records(ID,pruduct_id,supplier_id,date)
Solution 1:[1]
If I understood your question correctly then Laravel's Eloquent Relationships should do the trick for you.
Here is the documentation that will help you on this: https://laravel.com/docs/9.x/eloquent-relationships#one-to-many-inverse
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Satish Shanker Dongol |
