bristol-su /
assign-roles
| 1 | <?php |
||
| 2 | |||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 3 | namespace BristolSU\Module\AssignRoles\Events; |
||
| 4 | |||
| 5 | use BristolSU\ControlDB\Contracts\Models\Role; |
||
| 6 | use BristolSU\Support\Action\Contracts\TriggerableEvent; |
||
| 7 | |||
| 8 | class RoleCreated implements TriggerableEvent |
||
|
0 ignored issues
–
show
|
|||
| 9 | { |
||
| 10 | |||
| 11 | /** |
||
|
0 ignored issues
–
show
|
|||
| 12 | * @var Role |
||
| 13 | */ |
||
| 14 | private $role; |
||
|
0 ignored issues
–
show
|
|||
| 15 | |||
| 16 | 6 | public function __construct(Role $role) |
|
|
0 ignored issues
–
show
|
|||
| 17 | { |
||
| 18 | 6 | $this->role = $role; |
|
| 19 | 6 | } |
|
| 20 | |||
| 21 | /** |
||
|
0 ignored issues
–
show
|
|||
| 22 | * @inheritDoc |
||
| 23 | */ |
||
|
0 ignored issues
–
show
|
|||
| 24 | public function getFields(): array |
||
| 25 | { |
||
| 26 | return [ |
||
| 27 | 'role_id' => $this->role->id(), |
||
| 28 | 'position_id' => $this->role->positionId(), |
||
| 29 | 'position_name' => $this->role->position()->data()->name(), |
||
| 30 | 'role_name' => $this->role->data()->roleName(), |
||
| 31 | 'role_email' => $this->role->data()->email(), |
||
| 32 | ]; |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
|
0 ignored issues
–
show
|
|||
| 36 | * @inheritDoc |
||
| 37 | */ |
||
|
0 ignored issues
–
show
|
|||
| 38 | public static function getFieldMetaData(): array |
||
| 39 | { |
||
| 40 | return [ |
||
| 41 | 'role_id' => [ |
||
| 42 | 'label' => 'Role ID', |
||
| 43 | 'helptext' => 'ID of the role that was assigned to' |
||
| 44 | ], |
||
| 45 | 'position_id' => [ |
||
| 46 | 'label' => 'Position ID', |
||
| 47 | 'helptext' => 'ID of the position that was assigned to' |
||
| 48 | ], |
||
| 49 | 'position_name' => [ |
||
| 50 | 'label' => 'Position Name', |
||
| 51 | 'helptext' => 'Name of the position that was assigned to' |
||
| 52 | ], |
||
| 53 | 'role_name' => [ |
||
| 54 | 'label' => 'Role Name', |
||
| 55 | 'helptext' => 'Custom name for the role that was assigned to' |
||
| 56 | ], |
||
| 57 | 'role_email' => [ |
||
| 58 | 'label' => 'Role Email', |
||
| 59 | 'helptext' => 'Email of the role that was assigned to' |
||
| 60 | ] |
||
| 61 | ]; |
||
| 62 | } |
||
| 63 | } |