PromotionPoint.php 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | A3Mall
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2020 http://www.a3-mall.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: xzncit <158373108@qq.com>
  8. // +----------------------------------------------------------------------
  9. namespace app\admin\model\promotion;
  10. use app\common\models\goods\Goods;
  11. use app\common\models\promotion\PromotionPoint as PromotionPointModel;
  12. class PromotionPoint extends PromotionPointModel {
  13. /**
  14. * 增加查询条件
  15. * @param $query
  16. * @param $value
  17. * @param $data
  18. */
  19. public function searchTitleAttr($query, $value, $data){
  20. if(!empty($value)){
  21. $query->where('promotion_point.title','like','%'.$value.'%');
  22. }
  23. }
  24. public function goods(){
  25. return $this->hasOne(Goods::class,'id','goods_id')->joinType("LEFT")->bind(["photo"]);
  26. }
  27. }