Пример #1
0
 /**
  * Finds the Lead model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Lead the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Lead::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #2
0
 public function actionDelete($id)
 {
     Lead::findOne($id)->deleteRecursive();
     Yii::$app->getSession()->setFlash("success", 'The record was deleted.');
     return $this->redirect(["lead/"]);
 }