Commit 7c5368750a280e87b6066abbb7aaed34c422185b

Authored by Yarik
1 parent d16e87bd

Sms send

Showing 1 changed file with 23 additions and 4 deletions   Show diff stats
controllers/OrderController.php
@@ -237,7 +237,12 @@ @@ -237,7 +237,12 @@
237 $model->published = false; 237 $model->published = false;
238 $model->save(); 238 $model->save();
239 239
240 - return $this->redirect(['update', 'id' => $model->id]); 240 + return $this->redirect(
  241 + [
  242 + 'update',
  243 + 'id' => $model->id,
  244 + ]
  245 + );
241 246
242 $dataProvider = new ActiveDataProvider( 247 $dataProvider = new ActiveDataProvider(
243 [ 248 [
@@ -353,7 +358,7 @@ @@ -353,7 +358,7 @@
353 } 358 }
354 } 359 }
355 360
356 - public function actionFindProduct($q = NULL, $id = NULL) 361 + public function actionFindProduct($q = null, $id = null)
357 { 362 {
358 \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; 363 \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
359 $out = [ 364 $out = [
@@ -409,7 +414,7 @@ @@ -409,7 +414,7 @@
409 414
410 protected function findModel($id) 415 protected function findModel($id)
411 { 416 {
412 - if (( $model = Order::findOne($id) ) !== NULL) { 417 + if (( $model = Order::findOne($id) ) !== null) {
413 return $model; 418 return $model;
414 } else { 419 } else {
415 throw new NotFoundHttpException('The requested page does not exist.'); 420 throw new NotFoundHttpException('The requested page does not exist.');
@@ -472,9 +477,23 @@ @@ -472,9 +477,23 @@
472 $model->save(); 477 $model->save();
473 } 478 }
474 479
475 - public function actionPublishOrder($id) { 480 + public function actionPublishOrder($id)
  481 + {
476 $model = Order::findOne($id); 482 $model = Order::findOne($id);
477 $model->published = true; 483 $model->published = true;
478 $model->save(); 484 $model->save();
  485 + /**
  486 + * @var SmsSender $sender
  487 + */
  488 + $sender = \Yii::$app->sender;
  489 + $sender->send(
  490 + $model->phone,
  491 + $this->renderPartial(
  492 + '@common/mail/smsorder',
  493 + [
  494 + 'order_id' => $model->id,
  495 + ]
  496 + )
  497 + );
479 } 498 }
480 } 499 }