public function subsectors() { $sub_sectors = Subsector::whereIn('id', Occupation::select('subsector_id')->whereIn('id', Trainer::select('occupation_id')->where('report_date_id', $this->report_date_id)->where('institution_id', $this->institution_id)->distinct()->lists('occupation_id'))->distinct()->lists('subsector_id'))->get(); return $sub_sectors; }
public function for_print_rpt1_non_gov_drop_grad($id) { $user = Auth::user(); $region = Region::findOrFail($user->region_id); $report_date = ReportDate::findOrFail($id); $rpt1 = new RTAReport1NonGovernment($report_date->id, $user->region_id); // get occupations $occupations = Occupation::whereIn('id', DropoutGraduate::select('occupation_id')->where('report_date_id', $id)->whereIn('institution_id', Institution::select('id')->where('region_id', $region->id)->where('ownership', '!=', 'Public')->lists('id'))->lists('occupation_id'))->orderBy('name')->get(); // get sectors $sectors = Sector::whereIn('id', Subsector::select('sector_id')->whereIn('id', $occupations->lists('subsector_id'))->get())->get(); // get subsectors $subsectors = Subsector::whereIn('id', $occupations->lists('subsector_id'))->get(); return view('rtaadmin.print_rpt1nongov_7', compact('rpt1', 'region', 'report_date', 'sectors', 'subsectors', 'occupations')); }