backend\controllers\ApplyController::actionReject PHP Метод

actionReject() публичный Метод

public actionReject ( $id )
    public function actionReject($id)
    {
        try {
            $rejectApplyForm = new RejectApplyForm($id);
        } catch (InvalidParamException $e) {
            throw new BadRequestHttpException($e->getMessage());
        }
        if ($rejectApplyForm->load(Yii::$app->request->post()) && $rejectApplyForm->reject()) {
            if (!empty($rejectApplyForm->apply->store->cellphone)) {
                Yii::$app->smser->send($rejectApplyForm->apply->store->cellphone, "亲爱的店长,很抱歉您的采购订单{$rejectApplyForm->apply->apply_sn}申请失败,原因:{$rejectApplyForm->remark}");
            }
            Yii::$app->session->setFlash('success', '驳回成功!');
        } else {
            Yii::$app->session->setFlash('danger', '驳回失败!');
        }
        return $this->redirect(['view', 'id' => $id]);
    }