Code Duplication    Length = 7-8 lines in 2 locations

src/Traits/HasRoles.php 2 locations

@@ 62-68 (lines=7) @@
59
            $roles = collect([$roles]);
60
        }
61
62
        $roles = $roles->map(function ($role) {
63
            if ($role instanceof Role) {
64
                return $role;
65
            }
66
67
            return app(Role::class)->findByName($role, $this->getDefaultGuardName());
68
        });
69
70
        return $query->whereIn('role_ids', $roles->pluck('_id'));
71
    }
@@ 304-311 (lines=8) @@
301
     *
302
     * @return Role
303
     */
304
    protected function getStoredRole($role): Role
305
    {
306
        if (is_string($role)) {
307
            return app(Role::class)->findByName($role, $this->getDefaultGuardName());
308
        }
309
310
        return $role;
311
    }
312
313
    /**
314
     * Return a collection of role names associated with this user.