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