Textbook.php 993 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Textbook extends Model
  5. {
  6. protected $table = 'textbooks';
  7. protected $fillable = [
  8. 'series_id',
  9. 'stage',
  10. 'schooling_system',
  11. 'grade',
  12. 'semester',
  13. 'naming_scheme',
  14. 'track',
  15. 'module_type',
  16. 'volume_no',
  17. 'legacy_code',
  18. 'curriculum_standard_year',
  19. 'curriculum_revision_year',
  20. 'approval_authority',
  21. 'approval_year',
  22. 'edition_label',
  23. 'official_title',
  24. 'display_title',
  25. 'aliases',
  26. 'isbn',
  27. 'cover_path',
  28. 'status',
  29. 'sort_order',
  30. 'meta',
  31. ];
  32. protected $casts = [
  33. // 移除 array cast,直接使用 JSON 字符串
  34. ];
  35. public function series()
  36. {
  37. return $this->belongsTo(TextbookSeries::class);
  38. }
  39. public function catalogs()
  40. {
  41. return $this->hasMany(TextbookCatalog::class);
  42. }
  43. }