StoreBranchProductAttrValue.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\model\product\branch;
  12. use crmeb\basic\BaseModel;
  13. use crmeb\traits\ModelTrait;
  14. /**
  15. * Class StoreBranchProductAttrValue
  16. * @package app\model\product\branch
  17. */
  18. class StoreBranchProductAttrValue extends BaseModel
  19. {
  20. use ModelTrait;
  21. /**
  22. * 数据表主键
  23. * @var string
  24. */
  25. protected $pk = 'id';
  26. /**
  27. * 模型名称
  28. * @var string
  29. */
  30. protected $name = 'store_branch_product_attr_value';
  31. /**
  32. * @param $query
  33. * @param $value
  34. */
  35. public function searchStoreIdAttr($query, $value)
  36. {
  37. if ($value !== '') $query->where('store_id', $value);
  38. }
  39. /**
  40. * @param $query
  41. * @param $value
  42. */
  43. public function searchProductIdAttr($query, $value)
  44. {
  45. $query->where('product_id', $value);
  46. }
  47. /**
  48. * @param $query
  49. * @param $value
  50. */
  51. public function searchTypeAttr($query, $value)
  52. {
  53. $query->where('type', $value);
  54. }
  55. /**
  56. * @param $query
  57. * @param $value
  58. */
  59. public function searchUniqueAttr($query, $value)
  60. {
  61. if (is_array($value)) {
  62. $query->whereIn('unique', $value);
  63. } else {
  64. $query->where('unique', $value);
  65. }
  66. }
  67. }