uodate:数据获取用户角色,无需用户传参
This commit is contained in:
parent
390fc8ccd5
commit
f17570deef
@ -13,7 +13,7 @@ trait DataRangScopeTrait
|
||||
* @author JaguarJack <njphper@gmail.com>
|
||||
* @date 2020/6/6
|
||||
*/
|
||||
protected function dataRange($roles)
|
||||
public function dataRange($roles = [])
|
||||
{
|
||||
if (Utils::isSuperAdmin()) {
|
||||
return $this;
|
||||
@ -44,6 +44,10 @@ trait DataRangScopeTrait
|
||||
|
||||
$user = request()->user();
|
||||
|
||||
if (empty($roles)) {
|
||||
$roles = $user->getRoles();
|
||||
}
|
||||
|
||||
foreach ($roles as $role) {
|
||||
switch ($role->data_range) {
|
||||
case Roles::ALL_DATA:
|
||||
|
Loading…
x
Reference in New Issue
Block a user