/** * */ public static function getBlockedDate($arrLocation) { //query to read all the block dates for the locations $queryResult = SELF::whereIn('product_vendor_location_id', $arrLocation)->select('id', 'product_vendor_location_id', 'block_date')->get(); //array to store the block dates $arrBlockedDate = array(); foreach ($queryResult as $row) { if (!array_key_exists($row->vendor_location_id, $arrBlockedDate)) { $arrBlockedDate[$row->vendor_location_id] = array($row->block_date); } else { $arrBlockedDate[$row->vendor_location_id][] = $row->block_date; } } return $arrBlockedDate; }