Пример #1
0
 public function getSpecificBatchRegionCount($batch)
 {
     $batch = $batch * 100000;
     $batchEnd = $batch + 100000;
     $regionArray = [];
     $programids = Program::whereNotIn('programid', array(62, 66, 38, 22))->where('degreelevel', 'U')->lists('programid');
     $collegeDropouts = Studentdropout::whereIn('lastprogramid', $programids)->where('studentid', '>', $batch)->where('studentid', '<', $batchEnd)->get();
     $luzon = 0;
     $visayas = 0;
     $mindanao = 0;
     $unstated = 0;
     $luzonRegions = ['NCR', 'I', 'CAR', 'II', 'III', 'IV', 'V'];
     $visayasRegions = ['VI', 'VII', 'VIII'];
     $mindanaoRegions = ['IX', 'X', 'XI', 'XII', 'XIII', 'ARMM'];
     foreach ($collegeDropouts as $dropout) {
         $regionHolder = Studentaddress::getOneRegion($dropout->studentid);
         if (count($regionHolder) > 0) {
             $regionCode = preg_replace('/\\s+/', '', $regionHolder->regioncode);
             if (in_array($regionCode, $luzonRegions)) {
                 $luzon++;
             } elseif (in_array($regionCode, $visayasRegions)) {
                 $visayas++;
             } elseif (in_array($regionCode, $mindanaoRegions)) {
                 $mindanao++;
             }
         } else {
             $unstated++;
         }
     }
     $regionArray['Luzon'] = $luzon;
     $regionArray['Visayas'] = $visayas;
     $regionArray['Mindanao'] = $mindanao;
     $regionArray['Unstated'] = $unstated;
     return $regionArray;
 }