123456789101112131415161718192021222324252627282930313233343536 |
- <?php namespace App;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Support\Facades\DB;
- class Admin extends Model
- {
- protected $table = "admin";
- public $timestamps = false;
- public function getAdmin()
- {
- $this->belongsToMany("App\Admin");
- }
- //获取团队销售成员
- public static function getTeamSalers($team_ids){
- $data = array();
- foreach($team_ids as $team_id){
- $data[$team_id] = DB::table('admin')->where('team_id', $team_id)->lists('id');
- }
- return $data;
- }
- //获取销售团队
- public static function getTeams(){
- $data = DB::table('teams')->where('type', 1)->lists('id');
- return $data;
- }
- //获取团队名称
- public static function getTeamsName(){
- $data = DB::table('teams')->where('type', 1)->lists('name', 'id');
- return $data;
- }
- }
|