BasicType.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace App\Model;
  3. use App\Scopes\TopDepartmentScope;
  4. use Illuminate\Database\Eloquent\Model;
  5. class BasicType extends Model
  6. {
  7. protected $guarded = [];
  8. protected $table = "basic_type"; //指定表
  9. const CREATED_AT = 'crt_time';
  10. const UPDATED_AT = 'upd_time';
  11. protected $dateFormat = 'U';
  12. const type_22 = 22;
  13. public static $type = [
  14. 1 => '客户意向类型',
  15. 2 => '客户来源类型',
  16. 3 => '客户类型',
  17. 4 => '客户电话类型',
  18. 5 => '进展阶段类型',
  19. 6 => '客户状态类型',
  20. 7 => '决策关系类型',
  21. 8 => '客户分级',
  22. 9 => '状态类型',
  23. 10 => '车型',
  24. 11 => '订单类型',
  25. 12 => '成交类型',
  26. 13 => '合同状态',
  27. 14 => '合同类型',
  28. 15 => '付款方式',
  29. 16 => '发货状态',
  30. 17 => '物流公司',
  31. 18 => '安装方式',
  32. 19 => '紧急程度',
  33. 20 => '产品单位',
  34. 21 => '跟进方式',
  35. 22 => '产品价格',
  36. 23 => '安装地点',
  37. ];
  38. public static $user = [];
  39. public static $search = [];
  40. public static $is_search = false;
  41. public function __construct(array $attributes = [])
  42. {
  43. if(! empty($attributes['userData'])) {
  44. self::$user = $attributes['userData'];
  45. self::$search = $attributes['search'] ?? [];
  46. self::$is_search = true;
  47. }
  48. parent::__construct($attributes);
  49. }
  50. protected static function boot(){
  51. parent::boot();
  52. if(self::$is_search){
  53. static::addGlobalScope(new TopDepartmentScope(self::$user, self::$search));
  54. }
  55. }
  56. }