Commit d95219a3c4a0f9b8408f5de8bd2c0d669068bc58

Authored by Administrator
1 parent 9be31ea0

access in admin

backend/controllers/AccountsController.php
@@ -86,7 +86,8 @@ class AccountsController extends Controller @@ -86,7 +86,8 @@ class AccountsController extends Controller
86 $cities = DicCities::find()->all(); 86 $cities = DicCities::find()->all();
87 $margin = Margins::find()->all(); 87 $margin = Margins::find()->all();
88 $users = User::find()->all(); 88 $users = User::find()->all();
89 - 89 + $model->load(Yii::$app->request->post());
  90 + die( var_dump($model->validate()));
90 if ($model->load(Yii::$app->request->post()) && $model->save()) { 91 if ($model->load(Yii::$app->request->post()) && $model->save()) {
91 return $this->redirect(['view', 'id' => $model->id]); 92 return $this->redirect(['view', 'id' => $model->id]);
92 } else { 93 } else {
@@ -116,6 +117,7 @@ class AccountsController extends Controller @@ -116,6 +117,7 @@ class AccountsController extends Controller
116 $model->dt = date("Y.m.d" , $model->dt); 117 $model->dt = date("Y.m.d" , $model->dt);
117 118
118 if ($model->load(Yii::$app->request->post()) && $model->save()) { 119 if ($model->load(Yii::$app->request->post()) && $model->save()) {
  120 +
119 return $this->redirect(['view', 'id' => $model->id]); 121 return $this->redirect(['view', 'id' => $model->id]);
120 } else { 122 } else {
121 return $this->render('update', [ 123 return $this->render('update', [
backend/controllers/NewsController.php
@@ -31,7 +31,7 @@ class NewsController extends Controller @@ -31,7 +31,7 @@ class NewsController extends Controller
31 'class' => AccessControl::className(), 31 'class' => AccessControl::className(),
32 'rules' => [ 32 'rules' => [
33 [ 33 [
34 - 'actions' => ['login', 'error', 'download-photo','delete-image' ], 34 + 'actions' => ['login', 'error', 'price-list-upload','file-upload' ],
35 'allow' => true, 35 'allow' => true,
36 ], 36 ],
37 [ 37 [
backend/models/Accounts.php
@@ -48,9 +48,6 @@ use Yii; @@ -48,9 +48,6 @@ use Yii;
48 class Accounts extends \yii\db\ActiveRecord 48 class Accounts extends \yii\db\ActiveRecord
49 { 49 {
50 50
51 - public $re_pass;  
52 - public $surname;  
53 - public $verifyCode;  
54 51
55 /** 52 /**
56 * @inheritdoc 53 * @inheritdoc
@@ -75,19 +72,18 @@ class Accounts extends \yii\db\ActiveRecord @@ -75,19 +72,18 @@ class Accounts extends \yii\db\ActiveRecord
75 { 72 {
76 return [ 73 return [
77 [['if_manager', 'margin_id', 'country', 'city', 'rating', 'is_active', 'is_firm', 'office_id', 'is_scribe', 'set_manager_id', 'car', 'mod', 'deliveries', 'scode'], 'integer'], 74 [['if_manager', 'margin_id', 'country', 'city', 'rating', 'is_active', 'is_firm', 'office_id', 'is_scribe', 'set_manager_id', 'car', 'mod', 'deliveries', 'scode'], 'integer'],
78 - [['email', 'pass', 'name','surname', 'phones',], 'required'], 75 + [['email', 'pass', 'name', 'phones'], 'required'],
79 [['comment'], 'string'], 76 [['comment'], 'string'],
80 [['balance'], 'number'], 77 [['balance'], 'number'],
81 - [['email', 'name','surname', 'firm_site'], 'string', 'max' => 150],  
82 - [['pass','re_pass'], 'string', 'max' => 30], 78 + [['email', 'name', 'firm_site'], 'string', 'max' => 150],
  79 + [['pass'], 'string', 'max' => 30],
83 [['phones', 'phones2', 'phones3'], 'string', 'max' => 50], 80 [['phones', 'phones2', 'phones3'], 'string', 'max' => 50],
84 [['address', 'firm_inn', 'firm_bank'], 'string', 'max' => 254], 81 [['address', 'firm_inn', 'firm_bank'], 'string', 'max' => 254],
85 [['last_loginin'], 'string', 'max' => 15], 82 [['last_loginin'], 'string', 'max' => 15],
86 [['snumb', 'firm_ur_adr', 'firm_fiz_adr', 'firm_code_eg', 'firm_rs', 'firm_mfo', 'company'], 'string', 'max' => 255], 83 [['snumb', 'firm_ur_adr', 'firm_fiz_adr', 'firm_code_eg', 'firm_rs', 'firm_mfo', 'company'], 'string', 'max' => 255],
87 [['email'], 'unique'], 84 [['email'], 'unique'],
88 [['email'], 'email'], 85 [['email'], 'email'],
89 - ['re_pass', 'compare', 'compareAttribute' => 'pass'],  
90 - ['dt', 'date', 'format' => 'Y.m.d'] 86 + ['dt', 'date', 'format' => 'php:Y.m.d']
91 ]; 87 ];
92 } 88 }
93 89