public function actionToggle($id, $attribute)
 {
     $model = $this->findModel($id);
     $studentId = $model->student_id;
     $student = Student::findOne($studentId);
     if (Yii::$app->user->can('updateStudent', ['student' => $student])) {
         $action = new ToggleAction('toggle', $this, ['modelClass' => Affiliation::className()]);
         return $action->run($id, $attribute);
     }
 }
Exemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery relation
  */
 public function getAffiliations()
 {
     return $this->hasMany(Affiliation::className(), ['role_id' => 'id']);
 }