/** * Deletes an existing Tees model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { $model = $this->findModel($id); $course_id = $model->course_id; Hole::deleteAll(['tees_id' => $model->id]); $model->delete(); return $this->redirect(['course/view', 'id' => $course_id]); }