| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- namespace app\models;
- use Yii;
- /**
- * This is the model class for table "eventlog".
- *
- * @property integer $id
- * @property string $ip
- * @property integer $user_id
- * @property integer $auk_id
- * @property string $action
- * @property string $date
- */
- class Eventlog extends \yii\db\ActiveRecord
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'eventlog';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['ip', 'user_id', 'auk_id', 'action', 'date'], 'required'],
- [['user_id', 'auk_id'], 'integer'],
- [['date'], 'safe'],
- [['ip'], 'string', 'max' => 20],
- [['action'], 'string', 'max' => 255],
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'ip' => Yii::t('app','Ip ID'),
- 'user_id' => Yii::t('app','User ID'),
- 'auk_id' => Yii::t('app','TradeLog'),
- 'action' => Yii::t('app','Action ID'),
- 'date' => Yii::t('app','Date'),
- 'at_org' => Yii::t('app','User ID'),
- 'name' => Yii::t('app','AukName ID'),
- ];
- }
- public function PutLog($insert)
- {
- $model = new Eventlog();
- $model->setAttributes([
- 'user_id' => $insert['user_id'],
- 'ip' => $insert['ip'],
- 'auk_id' => isset($insert['auk_id'] ) ? $insert['auk_id'] : '',
- 'action' => $insert['action'],
- 'date' => date("Y-m-d H:i:s"),
- ]);
- $model->save(false);
- return true;
- }
- function getUser()
- {
- return $this->hasOne(User::className(),['id' => 'user_id']);
- }
- function getAuctions()
- {
- return $this->hasOne(Auctions::className(),['id' => 'auk_id']);
- }
- public function getLots()
- {
- return $this->hasOne(Lots::className(), ['id' => 'lot_id'])->via('auctions');
- }
- /**
- * @inheritdoc
- * @return EventlogQuery the active query used by this AR class.
- */
- public static function find()
- {
- return new EventlogQuery(get_called_class());
- }
- }
|