attributes['imgs'] = implode(',',$imgs); } } public function getImgsAttribute($imgs) { return explode(',',$imgs); } public function mp(){ return $this->hasOne('\App\Models\LanzuMpInfo','id','mp_id'); } /** * 获取市场数组 */ public static function getMarketArray($where = [], $options = []) { $model = self::whereNull('deleted_at'); // ->where('status',1) if(!empty($where)){ $model->where($where); } $list = $model->pluck('id','name')->toArray(); if(!empty($options)){ $new = array_merge($options,$list); return array_flip($new); }else{ return array_flip($list); } } /** * 获取单个市场信息 */ public static function getMarketInfo($id,$field = '*') { return self::select($field)->find($id); } }