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