Users.php 401 B

123456789101112131415161718192021222324
  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. /**
  5. * 分组模型
  6. */
  7. class Users extends Model
  8. {
  9. public function getByGroup($group=0){
  10. if ($group){
  11. return $this->where(['group_id'=>$group])->select();
  12. }else{
  13. return $this->all();
  14. }
  15. }
  16. public function groupinfo(){
  17. return $this->belongsTo('Groups','group_id','id');
  18. }
  19. }