TaoLer/app/admin/model/AuthGroup.php

40 lines
748 B
PHP
Raw Normal View History

2020-01-01 13:17:19 +08:00
<?php
namespace app\admin\model;
use think\Model;
//use think\model\concern\SoftDelete;
class AuthGroup extends Model
{
//软删除
2020-01-02 16:23:03 +08:00
//use SoftDelete;
// protected $deleteTime = 'delete_time';
//protected $defaultSoftDelete = 0;
//角色多对多关联角色分配表
public function GroupAccess()
{
return $this->hasMany('AuthGroupAccess','group_id','id');
}
2020-01-01 13:17:19 +08:00
//登陆校验
public function authRuleTree()
{
$authRules = $this->order('sort asc')->select();
return $this->sort($authRules);
}
public function sort($data,$pid=0)
{
static $arr = array();
foreach($data as $k=> $v){
if($v['pid']==$pid){
$arr[] = $v;
$this->sort($data,$v['id']);
}
}
return $arr;
}
}