'审核中', self::TYPE_MINUS_TWO => '已超期', self::TYPE_ONE => '待开始', self::TYPE_TWO => '进行中', self::TYPE_THREE => '已完成', ]; const Attr_TYPE_ONE = 1; const Attr_TYPE_TWO = 2; const Item_Attribute = [ self::TYPE_ONE => '自主开发', self::TYPE_TWO => '合作开发', ]; // 引入自定义字段预加载关系 use HasCustomFields; // 作用域 里面关联了客户自定义的表头数据 列表页需要 :: withCustomData($user) 这个是预加载 public function scopeWithCustomData($query, $user) { $top_depart_id = $user['top_depart_id']; return $query->with(['customFields' => function ($subQuery) use ($top_depart_id) { $subQuery->where('top_depart_id', $top_depart_id) ->where('table_name', $this->table) ->where('del_time', 0); }]); } }