Code Duplication    Length = 10-10 lines in 2 locations

src/Models/Permission.php 1 location

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

src/Models/Role.php 1 location

@@ 62-71 (lines=10) @@
59
    /**
60
     * A role 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_roles'),
68
            'role_id',
69
            config('permission.column_names.model_morph_key')
70
        );
71
    }
72
73
    /**
74
     * Find a role by its name and guard name.