修改权限返回数据结构

This commit is contained in:
JaguarJack
2020-04-14 20:31:38 +08:00
parent 9ddc932e89
commit 6da68f09cd
2 changed files with 24 additions and 5 deletions

View File

@@ -39,13 +39,15 @@ class Permissions extends CatchModel
public const PUT = 'put';
public const DELETE = 'delete';
public function getList()
public function getList($isMenu = false)
{
return $this->catchSearch()
->order('sort', 'desc')
->order('id', 'desc')
->select()
->toArray();
->when($isMenu, function ($query){
$query->where('type', self::MENU_TYPE);
})
->select();
}
public function roles(): \think\model\relation\BelongsToMany