change trigger to detect move in and move out
This commit is contained in:
@@ -4,6 +4,8 @@ namespace common\models;
|
||||
|
||||
use Yii;
|
||||
use common\components\Helper;
|
||||
use yii\behaviors\TimestampBehavior;
|
||||
use yii\helpers\ArrayHelper;
|
||||
|
||||
/**
|
||||
* This is the model class for table "door_log".
|
||||
@@ -30,6 +32,17 @@ class DoorLog extends \yii\db\ActiveRecord
|
||||
{
|
||||
return 'door_log';
|
||||
}
|
||||
|
||||
public function behaviors()
|
||||
{
|
||||
return ArrayHelper::merge( [
|
||||
[
|
||||
'class' => TimestampBehavior::className(),
|
||||
'value' => function(){ return date('Y-m-d H:i:s' ); },
|
||||
'updatedAtAttribute' => false,
|
||||
]
|
||||
], parent::behaviors());
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
|
||||
Reference in New Issue
Block a user