I have 3 models Company, Plan, and Service. What i'm trying to make is that each company should have plans 3-4 and each plan have it's own services that they provide.
Every company may have different plans and for those plans they may have different services.
I create a Many to Many Polymorphic relation for Plans called Planable, and this table will have companies's plans and services for these plans. But i was not able to retrieve the services for a specific company plans.
$company = Company::findOrFail($id);
foreach ($company->plans as $plan){
return $plan->services;
}
This is not working and it's only showing one service and it's separating each company with it's plans and services.
I would like to have make it like this $company->plans->services
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2z8uNTd
via IFTTT
Aucun commentaire:
Enregistrer un commentaire