Пример #1
0
 public function actionProfile()
 {
     $session = new \yii\web\Session();
     $post = Yii::$app->request->post();
     if (!empty($post)) {
         $pk = $session['user']->id;
         $user = \app\models\User::find($pk)->one();
         $user->fname = $post['User']['fname'];
         $user->lname = $post['User']['lname'];
         $user->usr = $post['User']['usr'];
         $user->pwd = $post['User']['pwd'];
         $user->tel = $post['User']['tel'];
         $user->email = $post['User']['email'];
         if ($user->save()) {
             $session->setFlash('message', 'บันทึกรายการแล้ว');
             $session['user'] = $user;
         }
     }
     return $this->render('profile', ['user' => $session['user'], 'session' => $session]);
 }
Пример #2
0
<?php

use yii\helpers\Html;
use app\assets\AppAsset;
use yii\widgets\ActiveForm;
AppAsset::register($this);
$session = new \yii\web\Session();
$this->beginPage();
?>

<!DOCTYPE html>
<html lang="<?php 
echo Yii::$app->language;
?>
">
    <head>
        <meta charset="<?php 
echo Yii::$app->charset;
?>
">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <?php 
echo Html::csrfMetaTags();
?>
        <title>ระบบร้านค้าปลีก</title>
        <?php 
$this->head();
?>
        <link rel="stylesheet" type="text/css" href="css/superhero.css"/>
        <style>
            .has-error{