From 41f1f1488d1de4e6c10a9d598974ba0dd7c041fc Mon Sep 17 00:00:00 2001 From: captainbeer Date: Thu, 30 Aug 2018 18:21:53 +0300 Subject: [PATCH] -Emails ready --- common/models/Customer.php | 4 ++-- frontend/controllers/SiteController.php | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/common/models/Customer.php b/common/models/Customer.php index 7539839..9297806 100644 --- a/common/models/Customer.php +++ b/common/models/Customer.php @@ -32,8 +32,8 @@ const STATUS_ACTIVE = 1; const STATUS_NO = 0; - const MALE = 1; - const FEMALE = 2; + const MALE = '1'; + const FEMALE = '2'; /** * {@inheritdoc} */ diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php index fe2528c..be1bfcc 100755 --- a/frontend/controllers/SiteController.php +++ b/frontend/controllers/SiteController.php @@ -178,7 +178,17 @@ ) ); - $this->mail($model); + try { + $this->mail($model); + } catch (\Exception $exception) { + \Yii::error($exception->getMessage() . '. On request: ' . $model->id); + + return $this->redirect([ 'site/index' ]); + } catch (\Throwable $throwable) { + \Yii::error($throwable->getMessage() . '. On request: ' . $model->id); + + return $this->redirect([ 'site/index' ]); + } return $this->redirect([ 'site/index' ]); } @@ -207,7 +217,12 @@ 'artboxcore@gmail.com' => 'Artbox Core', ] ) - ->setTo('kennen.md@gmail.com') + ->setTo( + [ + 'kennen.md@gmail.com', + 'kazimirova.artweb@gmail.com', + ] + ) ->setSubject('U have request!') ->attach(\Yii::getAlias('@' . trim($model->image, '/'))) ->send(); -- libgit2 0.21.4