<?php
|
namespace app\common\model\admin;
|
|
use app\common\model\BaseModel;
|
|
/**
|
* 数据字典
|
*/
|
class Application extends BaseModel
|
{
|
protected $name = 'dl_application';
|
protected $pk = 'id';
|
/**
|
* 关联权限
|
* @return \think\model\relation\HasMany
|
*/
|
public function access()
|
{
|
return $this->hasMany('RoleAccess', 'role_id', 'id');
|
}
|
/**
|
* 模板详情
|
*/
|
public static function detail($id)
|
{
|
return (new static())->with(['access'])->find($id);
|
}
|
|
/**
|
* 通过插件分类id查询
|
*/
|
public static function getListByPlusCategoryId($category_id){
|
$model = new static();
|
return $model::withoutGlobalScope()->where('category_id', '=', $category_id)
|
->with('access')
|
->where('is_delete', '=', 0)
|
->order('create_time','asc')
|
->select();
|
}
|
}
|