Esempio n. 1
0
 /**
  * Finds the Purchase model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Purchase the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Purchase::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 2
0
 public function actionComplaint()
 {
     $purchase = Purchase::findOne(Yii::$app->request->post('id'));
     if (!$purchase || !isset($purchase->shop)) {
         return;
     }
     Yii::$app->mailer->compose('complaint', ['purchase' => $purchase, 'user' => Yii::$app->user->identity])->setFrom(Yii::$app->params['emailFrom'])->setTo([$purchase->shop->email])->setSubject('Жалоба')->send();
 }