You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
704 B
37 lines
704 B
<?php
|
|
namespace tp5auth\model;
|
|
|
|
|
|
class AuthRole extends \think\Model
|
|
{
|
|
// 设置完整的数据表(包含前缀)
|
|
protected $name = 'auth_role';
|
|
|
|
//初始化属性
|
|
protected function initialize()
|
|
{
|
|
|
|
}
|
|
|
|
//一对多 权限授权
|
|
public function authAccess()
|
|
{
|
|
return $this->hasMany('AuthAccess','role_id','id');
|
|
}
|
|
|
|
/**
|
|
* 关联删除 AuthAccess
|
|
* @return bool
|
|
*/
|
|
public function authRoleDelete(){
|
|
if($this->delete()){
|
|
if($this->authAccess){
|
|
AuthAccess::where(['role_id'=>$this->id,'type'=>'admin_url'])->delete();
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
}
|
|
?>
|