| @@ 137-144 (lines=8) @@ | ||
| 134 | * |
|
| 135 | * @return array |
|
| 136 | */ |
|
| 137 | public function actionAssign(int $id) |
|
| 138 | { |
|
| 139 | $items = Yii::$app->getRequest()->post('items', []); |
|
| 140 | $assignmentModel = $this->findModel($id); |
|
| 141 | $assignmentModel->assign($items); |
|
| 142 | ||
| 143 | return $assignmentModel->getItems(); |
|
| 144 | } |
|
| 145 | ||
| 146 | /** |
|
| 147 | * Remove items |
|
| @@ 153-160 (lines=8) @@ | ||
| 150 | * |
|
| 151 | * @return array |
|
| 152 | */ |
|
| 153 | public function actionRemove(int $id) |
|
| 154 | { |
|
| 155 | $items = Yii::$app->getRequest()->post('items', []); |
|
| 156 | $assignmentModel = $this->findModel($id); |
|
| 157 | $assignmentModel->revoke($items); |
|
| 158 | ||
| 159 | return $assignmentModel->getItems(); |
|
| 160 | } |
|
| 161 | ||
| 162 | /** |
|
| 163 | * Finds the Assignment model based on its primary key value. |
|