35 lines
800 B
PHP
35 lines
800 B
PHP
<?php
|
|
|
|
namespace common\models;
|
|
|
|
use yii\behaviors\TimestampBehavior;
|
|
use yii\db\ActiveRecord;
|
|
|
|
class DrugStoreDrug extends \common\modelsgii\DrugStoreDrug
|
|
{
|
|
public function behaviors()
|
|
{
|
|
return [
|
|
[
|
|
'class' => TimestampBehavior::class,
|
|
'attributes' => [
|
|
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at','updated_at'],
|
|
ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
|
|
],
|
|
],
|
|
];
|
|
}
|
|
|
|
//关联门店
|
|
public function getStore()
|
|
{
|
|
return $this->hasOne(Store::class,['drugstore_id' => 'drugstore_id']);
|
|
}
|
|
|
|
//关联基础商品
|
|
public function getDrug()
|
|
{
|
|
return $this->hasOne(Drug::class,['id' => 'drug_id']);
|
|
}
|
|
}
|