feat: 产品
refactor: 产品详情页seo
This commit is contained in:
25
app/index/model/ProductRelatedModel.php
Normal file
25
app/index/model/ProductRelatedModel.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\index\model;
|
||||
|
||||
use app\common\model\ProductRelatedBaseModel;
|
||||
|
||||
/**
|
||||
* 相关产品表模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class ProductRelatedModel extends ProductRelatedBaseModel
|
||||
{
|
||||
// 关联产品
|
||||
public function product()
|
||||
{
|
||||
return $this->hasOne(ProductModel::class, 'id', 'related_product_id');
|
||||
}
|
||||
|
||||
// 所属产品范围查询
|
||||
public function scopeByProductId($builder, $product_id)
|
||||
{
|
||||
return $builder->where('product_id', '=', $product_id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user