| @@ 98-113 (lines=16) @@ | ||
| 95 | } |
|
| 96 | } |
|
| 97 | ||
| 98 | public function addRole($roleId) |
|
| 99 | {
|
|
| 100 | $this->checkEntity(); |
|
| 101 | $this->requireSingle(); |
|
| 102 | ||
| 103 | try {
|
|
| 104 | $this->entity->roles()->attach($roleId); |
|
| 105 | ||
| 106 | $this->save(); |
|
| 107 | } catch (\Exception $e) {
|
|
| 108 | $this->ajax->setStatus('error');
|
|
| 109 | $this->ajax->addError('role', $e->getMessage());
|
|
| 110 | ||
| 111 | return false; |
|
| 112 | } |
|
| 113 | } |
|
| 114 | ||
| 115 | public function removeRole($roleId) |
|
| 116 | {
|
|
| @@ 115-130 (lines=16) @@ | ||
| 112 | } |
|
| 113 | } |
|
| 114 | ||
| 115 | public function removeRole($roleId) |
|
| 116 | {
|
|
| 117 | $this->checkEntity(); |
|
| 118 | $this->requireSingle(); |
|
| 119 | ||
| 120 | try {
|
|
| 121 | $this->entity->roles()->detach($roleId); |
|
| 122 | ||
| 123 | $this->save(); |
|
| 124 | } catch (\Exception $e) {
|
|
| 125 | $this->ajax->setStatus('error');
|
|
| 126 | $this->ajax->addError('role', $e->getMessage());
|
|
| 127 | ||
| 128 | return false; |
|
| 129 | } |
|
| 130 | } |
|
| 131 | ||
| 132 | public function setRoles($roleIds = []) |
|
| 133 | {
|
|