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