/** * Deletes an existing Device model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { $this->findModel($id)->delete(); // delete all device in the device_action table with the $id DeviceAction::deleteAll('device_id = :device_id', [':device_id' => $id]); return $this->redirect(['index']); }