public function __construct()
 {
     date_default_timezone_set("Asia/Manila");
     $accessibles = accountaccessiblelinks::where("department_id", Auth::user()->department_id)->get();
     $collection = array();
     foreach ($accessibles as $accessible) {
         array_push($collection, $accessible->link_id);
     }
     $this->countries = countries::all();
     if (Auth::user()->province) {
         $this->region = Auth::user()->region;
     } else {
         //user is not lgu/dilg ro
     }
     $this->chooseProvince = "<select name = 'province'>";
     if (Auth::user()->province) {
         foreach (provinces::where("region_id", accountsStrategy::findRegionIdByName(Auth::user()->region))->get() as $province) {
             $this->chooseProvince .= "<option value = '{$province->province}'>{$province->province}</option>";
         }
     }
     $this->chooseProvince .= "</select>";
     $this->provinces = Auth::user()->province ? Auth::user()->province : $this->chooseProvince;
     $this->department = accountsStrategy::determineDepartment(Auth::user()->department_id);
     $this->links = links::whereIn('id', $collection)->orderBy("id", "desc")->get();
     $matchThese = [];
     if (Auth::user()->province) {
         $matchThese["province"] = Auth::user()->province;
     }
     if (Auth::user()->region) {
         $matchThese["region"] = Auth::user()->region;
     }
     switch (Auth::user()->department_id) {
         case 1:
             //lgu. see all. because lgu needs to see status and remarks
             break;
         case 2:
             //blgs
             //see only 'ON PROCESS (BLGS)' for correcting/giving remarks
             switch (Auth::user()->accountType_id) {
                 case 4:
                 case 5:
                 case 6:
                 case 7:
                     $matchThese["applicationstatus_id"] = 1;
                     break;
                 case 8:
                     $matchThese["applicationstatus_id"] = 2;
                     break;
                 case 9:
                     $matchThese["applicationstatus_id"] = 3;
                     break;
             }
             break;
         case 3:
             //DILGRO
             //same as lgu.
             break;
         case 4:
             //USEC
             $matchThese["applicationstatus"] = "ON PROCESS USEC";
             break;
         case 5:
             //OSEC
             $matchThese["applicationstatus"] = "ON PROCESS OSEC";
             $matchThese["position"] = "GOVERNOR";
             break;
         case 6:
             //IMMIGRATION
             $matchThese["applicationstatus"] = "ON PROCESS IMMIGRATION";
             break;
     }
     $travelApplications = travelApplication::where($matchThese)->orderBy('created_at', 'desc')->get();
     $this->data['municipalities'] = "";
     foreach (refcitymun::get() as $municipality) {
         $this->data['municipalities'] .= "<option value = '" . $municipality->citymunDesc . "''>" . $municipality->citymunDesc . "</option>";
     }
     $this->data = ['links' => $this->links, 'travelApplications' => $travelApplications, 'department' => $this->department, 'countries' => $this->countries, 'region' => $this->region, 'provinces' => $this->provinces];
 }
 public static function getAllProvincesOptions()
 {
     $provinces = provinces::all();
     $output = "<option value = ''>Any province/City</option>";
     foreach ($provinces as $province) {
         $selected = "";
         if (isset($_POST['province'])) {
             if ($_POST['province'] == $province->province) {
                 $selected = " selected ";
             }
         }
         $output .= "<option {$selected} value = '{$province->province}'>{$province->province}</option>";
     }
     return $output;
 }