Jelajahi Sumber

教材相关

yemeishu 1 Minggu lalu
induk
melakukan
410724ad65
1 mengubah file dengan 50 tambahan dan 0 penghapusan
  1. 50 0
      app/Models/Textbook.php

+ 50 - 0
app/Models/Textbook.php

@@ -0,0 +1,50 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Textbook extends Model
+{
+    protected $table = 'textbooks';
+
+    protected $fillable = [
+        'series_id',
+        'stage',
+        'schooling_system',
+        'grade',
+        'semester',
+        'naming_scheme',
+        'track',
+        'module_type',
+        'volume_no',
+        'legacy_code',
+        'curriculum_standard_year',
+        'curriculum_revision_year',
+        'approval_authority',
+        'approval_year',
+        'edition_label',
+        'official_title',
+        'display_title',
+        'aliases',
+        'isbn',
+        'cover_path',
+        'status',
+        'sort_order',
+        'meta',
+    ];
+
+    protected $casts = [
+        // 移除 array cast,直接使用 JSON 字符串
+    ];
+
+    public function series()
+    {
+        return $this->belongsTo(TextbookSeries::class);
+    }
+
+    public function catalogs()
+    {
+        return $this->hasMany(TextbookCatalog::class);
+    }
+}