Esempio n. 1
0
 public static function get_districts_selected($id)
 {
     $district = PartnerDistrict::select('district', 'name');
     $district->join('district', 'district_id', '=', 'district.id', 'left');
     $district->join('sector', 'sector_id', '=', 'sector.id', 'left');
     $district->where('partner_id', $id);
     return $district->get()->toArray();
 }
Esempio n. 2
0
 /**
  * Update the sector and district for the partner
  *
  * @param  int  $id
  * @return Response
  */
 public static function updatesector($request, $id)
 {
     $districts = $request->get('district_id');
     $sectors = $request->get('sector_id');
     foreach ($districts as $district) {
         foreach ($sectors as $sector) {
             $save['partner_id'] = $id;
             $save['district_id'] = $district;
             $save['sector_id'] = $sector;
             PartnerDistrict::create($save);
             unset($save);
         }
     }
 }