Aucune description

Admin.php 859B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php namespace App;
  2. use Illuminate\Database\Eloquent\Model;
  3. use Illuminate\Support\Facades\DB;
  4. class Admin extends Model
  5. {
  6. protected $table = "admin";
  7. public $timestamps = false;
  8. public function getAdmin()
  9. {
  10. $this->belongsToMany("App\Admin");
  11. }
  12. //获取团队销售成员
  13. public static function getTeamSalers($team_ids){
  14. $data = array();
  15. foreach($team_ids as $team_id){
  16. $data[$team_id] = DB::table('admin')->where('team_id', $team_id)->lists('id');
  17. }
  18. return $data;
  19. }
  20. //获取销售团队
  21. public static function getTeams(){
  22. $data = DB::table('teams')->where('type', 1)->lists('id');
  23. return $data;
  24. }
  25. //获取团队名称
  26. public static function getTeamsName(){
  27. $data = DB::table('teams')->where('type', 1)->lists('name', 'id');
  28. return $data;
  29. }
  30. }