Commit d95219a3c4a0f9b8408f5de8bd2c0d669068bc58

Authored by Administrator
1 parent 9be31ea0

access in admin

backend/controllers/AccountsController.php
... ... @@ -86,7 +86,8 @@ class AccountsController extends Controller
86 86 $cities = DicCities::find()->all();
87 87 $margin = Margins::find()->all();
88 88 $users = User::find()->all();
89   -
  89 + $model->load(Yii::$app->request->post());
  90 + die( var_dump($model->validate()));
90 91 if ($model->load(Yii::$app->request->post()) && $model->save()) {
91 92 return $this->redirect(['view', 'id' => $model->id]);
92 93 } else {
... ... @@ -116,6 +117,7 @@ class AccountsController extends Controller
116 117 $model->dt = date("Y.m.d" , $model->dt);
117 118  
118 119 if ($model->load(Yii::$app->request->post()) && $model->save()) {
  120 +
119 121 return $this->redirect(['view', 'id' => $model->id]);
120 122 } else {
121 123 return $this->render('update', [
... ...
backend/controllers/NewsController.php
... ... @@ -31,7 +31,7 @@ class NewsController extends Controller
31 31 'class' => AccessControl::className(),
32 32 'rules' => [
33 33 [
34   - 'actions' => ['login', 'error', 'download-photo','delete-image' ],
  34 + 'actions' => ['login', 'error', 'price-list-upload','file-upload' ],
35 35 'allow' => true,
36 36 ],
37 37 [
... ...
backend/models/Accounts.php
... ... @@ -48,9 +48,6 @@ use Yii;
48 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 53 * @inheritdoc
... ... @@ -75,19 +72,18 @@ class Accounts extends \yii\db\ActiveRecord
75 72 {
76 73 return [
77 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 76 [['comment'], 'string'],
80 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 80 [['phones', 'phones2', 'phones3'], 'string', 'max' => 50],
84 81 [['address', 'firm_inn', 'firm_bank'], 'string', 'max' => 254],
85 82 [['last_loginin'], 'string', 'max' => 15],
86 83 [['snumb', 'firm_ur_adr', 'firm_fiz_adr', 'firm_code_eg', 'firm_rs', 'firm_mfo', 'company'], 'string', 'max' => 255],
87 84 [['email'], 'unique'],
88 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  
... ...