"是", self::isSubjectNo => "否" ); const isIndexMap = array( self::isIndexYes => "是", self::isIndexNo => "否" ); protected $fillable = ['name','pid','rank','is_index','is_subject','pic','index_pic','index_info']; protected $casts = ['banner'=>'array']; public function getPicAttribute() { return isset($this->attributes['pic']) ? config('console.pic_path').$this->attributes['pic'] : NULL; } public function getIndexPicAttribute() { return isset($this->attributes['index_pic']) ? config('console.pic_path').$this->attributes['index_pic'] : NULL; } public function mentalityDrill(){ return $this->hasMany(MentalityDrill::class, 'category_id', 'id'); } }