コード例 #1
0
 public function actionProfile()
 {
     $destination = $this->getDestinationAccount();
     $lastOrderShipping = OrderShipping::find()->where(['shipping_email' => $destination->email])->orderBy(['order_id' => SORT_DESC])->one();
     if (Yii::$app->request->isPost && isset($_REQUEST['password'])) {
         if (!empty(Yii::$app->request->post('password'))) {
             $destination->password = Yii::$app->request->post('password');
             $destination->save();
             Yii::$app->session->setFlash('password-info', Yii::t('app', 'Password updated successfully'));
         } else {
             Yii::$app->session->setFlash('password-error', Yii::t('app', 'Password cannot be empty'));
         }
     }
     return $this->render('profile', ['dataProvider' => $this->getBuyersDP($destination), 'destination' => $destination, 'shipping' => $lastOrderShipping]);
 }