public function getByRestaurantLocationId($id) { $vendorLocationWithAttributes = VendorLocation::with('attributesBoolean', 'attributesDate', 'attributesInteger', 'attributesFloat', 'attributesText', 'attributesVarChar', 'attributesSingleSelect', 'attributesMultiSelect', 'schedules')->findOrFail($id); /*->wherehas('vendor.vendorType',function($q) { $q->where('type','Restaurants'); })->first();*/ //dd(array_flatten($vendorLocationWithAttributes->schedules->toArray())); $this->populateVendorAttributes($vendorLocationWithAttributes->attributesBoolean); $this->populateVendorAttributes($vendorLocationWithAttributes->attributesInteger); $this->populateVendorAttributes($vendorLocationWithAttributes->attributesFloat); $this->populateVendorAttributes($vendorLocationWithAttributes->attributesDate); $this->populateVendorAttributes($vendorLocationWithAttributes->attributesText); $this->populateVendorAttributes($vendorLocationWithAttributes->attributesVarChar); $this->populateVendorAttributes($vendorLocationWithAttributes->attributesSingleSelect); $this->populateVendorMultiSelectAttributes($vendorLocationWithAttributes->attributesMultiSelect); $this->populateVendorSchedules($id); return ['RestaurantLocation' => VendorLocation::find($id), 'schedules' => $this->schedules, 'attributes' => $this->attributes]; }
/** * Returns all the location of a Vendor matching * the passed id. * * @static true * @access public * @param integer $vendorID * @return array * @since v1.0.0 */ public static function getVendorLocation($vendorID) { //array to contain the list of locations $arrLocation = array(); foreach (VendorLocation::with('location')->where('vendor_id', '=', $vendorID)->get() as $vendorLocation) { $arrLocation[] = array('name' => $vendorLocation->location->name, 'slug' => $vendorLocation->slug); } return $arrLocation; }