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

@@ 86-95 (lines=10) @@
83
    /**
84
     * A role belongs to some users of the model associated with its guard.
85
     */
86
    public function users(): MorphToMany
87
    {
88
        return $this->morphedByMany(
89
            getModelForGuard($this->attributes['guard_name']),
90
            'model',
91
            config('permission.table_names.model_has_roles'),
92
            'role_id',
93
            config('permission.column_names.model_morph_key')
94
        );
95
    }
96
97
    /**
98
     * Find a role by its name and guard name.