Discussion.php 811 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. class Discussion extends Model
  6. {
  7. use HasFactory;
  8. protected $primaryKey = 'id';
  9. protected $casts = [
  10. 'id' => 'string',
  11. 'pos_start' => 'integer',
  12. 'pos_end' => 'integer',
  13. ];
  14. // 批量填充
  15. protected $fillable = [
  16. 'res_id',
  17. 'res_type',
  18. 'type',
  19. 'tpl_id',
  20. 'title',
  21. 'content',
  22. 'content_type',
  23. 'parent',
  24. 'editor_uid',
  25. 'pos_start',
  26. 'pos_end',
  27. 'quote_exact',
  28. 'quote_prefix',
  29. 'quote_suffix',
  30. ];
  31. // 设置默认值
  32. protected $attributes = [
  33. 'content_type' => 'markdown',
  34. 'type' => 'discussion',
  35. ];
  36. }