| Current Path : /var/www/html/project/models/ |
| Current File : /var/www/html/project/models/Log.php |
<?php
namespace app\models;
use Yii;
/**
* This is the model class for table "log".
*
* @property int $id
* @property int $user_id
* @property int $menu_id
* @property string $action_type
* @property string $data_uuid
* @property string $action_datetime
*/
class Log extends \yii\db\ActiveRecord {
/**
* {@inheritdoc}
*/
public static function tableName() {
return 'log';
}
/**
* {@inheritdoc}
*/
public function rules() {
return [
[['user_id'], 'integer'],
[['action_datetime', 'modules', 'data_id'], 'safe'],
[['action_type'], 'string', 'max' => 255],
];
}
/**
* {@inheritdoc}
*/
public function insertlog($modules, $action_type, $data_id) {
$model = new Log();
$model->user_id = Yii::$app->user->identity->id;
$model->action_datetime = date("Y-m-d H:i:s");
$model->modules = $modules;
$model->action_type = $action_type;
$model->data_id = $data_id;
$model->save();
}
}