芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/xmintal-back/models/Profile.php
100], [['trash','active'],'integer'] ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => Yii::t('app', 'ID'), 'name' => Yii::t('app', 'Name'), 'is_visible' => Yii::t('app', 'Is Visible'), 'permissions' => Yii::t('app', 'Permissions'), 'sort' => Yii::t('app', 'Sort'), 'created' => Yii::t('app', 'Created'), 'updated' => Yii::t('app', 'Updated'), 'trash' => Yii::t('app', 'Trash'), 'active' => Yii::t('app', 'Active'), ]; } public function beforeSave($insert) { if (!parent::beforeSave($insert)) { return false; } $array = json_decode($this->permissions, true); $filteredArray = array_filter($array, function($item) { return !is_null($item); }); $reindexedArray = array_values($filteredArray); $this->permissions=Json::encode($reindexedArray); return true; } public function afterSave( $insert, $changedAttributes ){ Yii::$app->response->setStatusCode(401); $q='UPDATE {{%user}} SET profile_changes=1 WHERE profile_id='.$this->id; Yii::$app->db->createCommand($q)->execute(); } /** * Gets query for [[Users]]. * * @return \yii\db\ActiveQuery */ public function getUsers() { return $this->hasMany(User::class, ['profile_id' => 'id']); } }