32 lines
598 B
PHP
32 lines
598 B
PHP
<?php
|
|
|
|
|
|
|
|
namespace app\common\model\store;
|
|
|
|
use app\common\model\BaseModel;
|
|
use app\common\model\system\Relevance;
|
|
use app\common\repositories\system\RelevanceRepository;
|
|
|
|
class PriceRule extends BaseModel
|
|
{
|
|
|
|
public static function tablePk(): string
|
|
{
|
|
return 'rule_id';
|
|
}
|
|
|
|
|
|
public static function tableName(): string
|
|
{
|
|
return 'price_rule';
|
|
}
|
|
|
|
public function cate()
|
|
{
|
|
return $this->hasMany(Relevance::class, 'left_id', 'rule_id')->where([
|
|
'type' => RelevanceRepository::PRICE_RULE_CATEGORY
|
|
])->with(['category']);
|
|
}
|
|
}
|