TextbookSeries.php 577 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class TextbookSeries extends Model
  5. {
  6. protected $table = 'textbook_series';
  7. protected $fillable = [
  8. 'name',
  9. 'slug',
  10. 'publisher',
  11. 'region',
  12. 'stages',
  13. 'start_year',
  14. 'is_active',
  15. 'sort_order',
  16. 'meta',
  17. ];
  18. protected $casts = [
  19. 'is_active' => 'boolean',
  20. // 移除 array cast,直接使用 JSON 字符串
  21. ];
  22. public function textbooks()
  23. {
  24. return $this->hasMany(Textbook::class);
  25. }
  26. }