'array', 'meta' => 'array', 'grade' => 'integer', 'semester' => 'integer', 'volume_no' => 'integer', 'curriculum_standard_year' => 'integer', 'curriculum_revision_year' => 'integer', 'approval_year' => 'integer', 'sort_order' => 'integer', ]; public function __construct(array $attributes = []) { parent::__construct($attributes); // 从 API 数据初始化时设置属性 foreach ($attributes as $key => $value) { $this->setAttribute($key, $value); } } public function series() { return $this->belongsTo(TextbookSeries::class); } public function catalogs() { return $this->hasMany(TextbookCatalog::class); } /** * 获取系列信息(兼容 API 返回的嵌套对象) */ public function getSeriesAttribute($value) { if (is_array($value)) { return (object) $value; } return $value; } }