[1], '2' =>[2], '3' =>[3], '4' =>[1,2], '5' =>[1,3], '6' =>[2,3], '7' =>[1,2,3], ]; public static $levelCourse = [ '1' =>[1,4,5,7], '2' =>[2,4,6,7], '3' =>[3,5,6,7], ]; public function getImgAttribute($value) { return json_decode($value,'true'); } public function getAudioAttribute($value) { return json_decode($value,'true'); } public function getVideoAttribute($value) { return json_decode($value,'true'); } protected function serializeDate(DateTimeInterface $date): string { return $date->format('Y-m-d H:i:s'); } public function getCreateAtHumansAttribute($key)//此处的Pic与追加字段'pic' 相对应 { return Carbon::createFromFormat('Y-m-d H:i:s', $this->attributes['created_at'])->diffForHumans(); } // public function getCreatedAtAttribute($value){ // return Carbon::createFromFormat('Y-m-d H:i:s', $value)->diffForHumans(); // } public static function setField() { return self::query()->select('id', 'title', 'is_share', 'cate', 'perface', 'img', 'video', 'audio', 'c_id', 'avatar', 'author', 'permission', 'is_top', 'top_at', 'state', 'collection', 'share', 'comms', 'created_at', 'updated_at'); } }