public function getByExperienceId($id) { $productWithAttributes = Product::with('attributesBoolean', 'attributesDate', 'attributesInteger', 'attributesFloat', 'attributesText', 'attributesVarChar', 'attributesSingleSelect', 'attributesMultiSelect')->findOrFail($id); /*->wherehas('vendor.vendorType',function($q) { $q->where('type','Restaurants'); })->first();*/ //dd(array_flatten($vendorLocationWithAttributes->schedules->toArray())); $this->populateExperienceAttributes($productWithAttributes->attributesBoolean); $this->populateExperienceAttributes($productWithAttributes->attributesInteger); $this->populateExperienceAttributes($productWithAttributes->attributesFloat); $this->populateExperienceAttributes($productWithAttributes->attributesDate); $this->populateExperienceAttributes($productWithAttributes->attributesText); $this->populateExperienceAttributes($productWithAttributes->attributesVarChar); $this->populateExperienceAttributes($productWithAttributes->attributesSingleSelect); $this->populateExperienceMultiSelectAttributes($productWithAttributes->attributesMultiSelect); //$this->populateExperienceSchedules($id); return ['Experience' => Product::find($id), 'attributes' => $this->attributes]; }