MedicalCareProductAttrValue.php 1013 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace app\admin\model;
  3. use support\Db;
  4. use support\Model;
  5. /**
  6. * 医疗产品属性设置
  7. * Class Users
  8. * @package app\admin\model
  9. */
  10. class MedicalCareProductAttrValue extends Model
  11. {
  12. /**
  13. * The table associated with the model.
  14. *
  15. * @var string
  16. */
  17. protected $table = 'medical_care_product_attr_value';
  18. public $timestamps = false;
  19. /**
  20. * Notes:获取产品列表
  21. * @param string $keywords
  22. * @param int $page
  23. * @param int $limit
  24. * @return array
  25. * User: QJF
  26. * Date: 2022/9/26
  27. */
  28. public static function getProductAttrList(int $page, int $limit,$keywords)
  29. {
  30. $list = static::select('*')
  31. ->orderBy('attr_create_time','DESC')
  32. ->forPage($page, $limit)
  33. ->get();
  34. $count = static::when($keywords != '', function ($query) use ($keywords){
  35. $query->where('product_name', 'like', '%' . $keywords . '%');
  36. })->count();
  37. return [$list, $count];
  38. }
  39. }