where('is_checked',1)->orderBy('sort','desc')->orderBy('id','desc')->pluck('name','id'); } public static function getTypeKey($type,$key=''){ $arr= self::where('type',$type)->where('is_checked',1)->get()->toArray(); if($key) { return data_to_key($arr,$key); } return $arr; } public function getContent(){ return $this->hasOne('App\Models\Article','category_id','id'); } public function getTypeNameAttribute() { $arr= config('adconfig.category_group'); return $arr[$this->type]; } }