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