32 lines
802 B
PHP
32 lines
802 B
PHP
<?php
|
|
|
|
namespace common\models\oldDb;
|
|
|
|
use yii\behaviors\TimestampBehavior;
|
|
use yii\db\ActiveRecord;
|
|
|
|
class HealthyNews extends \common\modelsgii\oldDb\HealthyNews
|
|
{
|
|
public function behaviors()
|
|
{
|
|
return [
|
|
[
|
|
'class' => TimestampBehavior::class,
|
|
'attributes' => [
|
|
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at','updated_at'],
|
|
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
|
|
],
|
|
],
|
|
];
|
|
}
|
|
|
|
//关联用户收藏
|
|
public function getCollect()
|
|
{
|
|
return $this->hasOne(UserCollect::className(),['object_id'=>'id'])
|
|
->where(['type'=>1,'user_id'=>\Yii::$app->user->identity->id])
|
|
->select('object_id,is_delete');
|
|
}
|
|
|
|
}
|