diff --git a/controllers/OrderController.php b/controllers/OrderController.php index d390152..79257d4 100755 --- a/controllers/OrderController.php +++ b/controllers/OrderController.php @@ -237,7 +237,12 @@ $model->published = false; $model->save(); - return $this->redirect(['update', 'id' => $model->id]); + return $this->redirect( + [ + 'update', + 'id' => $model->id, + ] + ); $dataProvider = new ActiveDataProvider( [ @@ -353,7 +358,7 @@ } } - public function actionFindProduct($q = NULL, $id = NULL) + public function actionFindProduct($q = null, $id = null) { \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; $out = [ @@ -409,7 +414,7 @@ protected function findModel($id) { - if (( $model = Order::findOne($id) ) !== NULL) { + if (( $model = Order::findOne($id) ) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); @@ -472,9 +477,23 @@ $model->save(); } - public function actionPublishOrder($id) { + public function actionPublishOrder($id) + { $model = Order::findOne($id); $model->published = true; $model->save(); + /** + * @var SmsSender $sender + */ + $sender = \Yii::$app->sender; + $sender->send( + $model->phone, + $this->renderPartial( + '@common/mail/smsorder', + [ + 'order_id' => $model->id, + ] + ) + ); } } -- libgit2 0.21.4