Exemplo n.º 1
0
 /**
  * Get the assigned vle for the specified card with sector and district
  * params @int $id
  *
  * return array
  */
 public static function get_partners($id, $sid)
 {
     $partners = Card::select('users.*');
     $partners->leftjoin('partner_district_sector', function ($join) use($sid) {
         $join->on('partner_district_sector.district_id', '=', static::$c_district_id);
         $join->where('partner_district_sector.sector_id', '=', $sid);
     });
     $partners->join('users', 'users.id', '=', 'partner_district_sector.partner_id', 'left');
     $partners->where(static::$c_id, $id);
     $partners->where('group_id', 3);
     $partners->orderby(static::$u_name, 'asc');
     return $partners->get();
 }