Code Duplication    Length = 13-13 lines in 2 locations

src/Traits/EntrustRoleTrait.php 1 location

@@ 20-32 (lines=13) @@
17
trait EntrustRoleTrait
18
{
19
    //Big block of caching functionality.
20
    public function cachedPermissions()
21
    {
22
        $rolePrimaryKey = $this->primaryKey;
23
        $cacheKey       = 'entrust_permissions_for_role_' . $this->$rolePrimaryKey;
24
        if (Cache::getStore() instanceof TaggableStore) {
25
            return Cache::tags(Config::get('admin.permission_role_table'))->remember($cacheKey,
26
                Config::get('cache.ttl', 60), function () {
27
                    return $this->perms()->get();
28
                });
29
        } else {
30
            return $this->perms()->get();
31
        }
32
    }
33
34
    public function save(array $options = [])
35
    {   //both inserts and updates

src/Traits/EntrustUserTrait.php 1 location

@@ 21-33 (lines=13) @@
18
trait EntrustUserTrait
19
{
20
    //Big block of caching functionality.
21
    public function cachedRoles()
22
    {
23
        $userPrimaryKey = $this->primaryKey;
24
        $cacheKey       = 'entrust_roles_for_user_' . $this->$userPrimaryKey;
25
        if (Cache::getStore() instanceof TaggableStore) {
26
            return Cache::tags(Config::get('admin.role_user_table'))->remember($cacheKey,
27
                Config::get('cache.ttl'), function () {
28
                    return $this->roles()->get();
29
                });
30
        } else {
31
            return $this->roles()->get();
32
        }
33
    }
34
35
    public function save(array $options = [])
36
    {   //both inserts and updates