Code Duplication    Length = 10-10 lines in 2 locations

src/Models/Permission.php 1 location

@@ 62-71 (lines=10) @@
59
    /**
60
     * A permission belongs to some users of the model associated with its guard.
61
     */
62
    public function users(): MorphToMany
63
    {
64
        return $this->morphedByMany(
65
            getModelForGuard($this->attributes['guard_name']),
66
            'model',
67
            config('permission.table_names.model_has_permissions'),
68
            'permission_id',
69
            config('permission.column_names.model_morph_key')
70
        );
71
    }
72
73
    /**
74
     * Find a permission by its name (and optionally guardName).

src/Models/Role.php 1 location

@@ 59-68 (lines=10) @@
56
    /**
57
     * A role belongs to some users of the model associated with its guard.
58
     */
59
    public function users(): MorphToMany
60
    {
61
        return $this->morphedByMany(
62
            getModelForGuard($this->attributes['guard_name']),
63
            'model',
64
            config('permission.table_names.model_has_roles'),
65
            'role_id',
66
            config('permission.column_names.model_morph_key')
67
        );
68
    }
69
70
    /**
71
     * Find a role by its name and guard name.