remove spaces from password
This commit is contained in:
parent
3daeae0293
commit
eb09f95ff8
@ -64,6 +64,12 @@ class UserCard extends \common\models\UserCard
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function beforeSave($insert)
|
||||||
|
{
|
||||||
|
$this->salary = str_replace(' ', '', \Yii::$app->request->post('UserCard')['salary']);
|
||||||
|
return parent::beforeSave($insert); // TODO: Change the autogenerated stub
|
||||||
|
}
|
||||||
|
|
||||||
public function afterSave($insert, $changedAttributes)
|
public function afterSave($insert, $changedAttributes)
|
||||||
{
|
{
|
||||||
$post = \Yii::$app->request->post('UserCard');
|
$post = \Yii::$app->request->post('UserCard');
|
||||||
|
17
console/controllers/SqlController.php
Normal file
17
console/controllers/SqlController.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace console\controllers;
|
||||||
|
|
||||||
|
|
||||||
|
use Yii;
|
||||||
|
use yii\console\Controller;
|
||||||
|
|
||||||
|
class SqlController extends Controller
|
||||||
|
{
|
||||||
|
public function actionSalary()
|
||||||
|
{
|
||||||
|
$sql = "UPDATE user_card SET salary=REPLACE( `salary`, ' ', '' )";
|
||||||
|
Yii::$app->db->createCommand($sql)->execute();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user