Discussion.php 629 B

12345678910111213141516171819202122232425262728293031323334
  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. ];
  12. //批量填充
  13. protected $fillable = [
  14. 'res_id',
  15. 'res_type',
  16. 'type',
  17. 'tpl_id',
  18. 'title',
  19. 'content',
  20. 'content_type',
  21. 'parent',
  22. 'editor_uid',
  23. ];
  24. // 设置默认值
  25. protected $attributes = [
  26. 'content_type' => 'markdown',
  27. 'type' => 'discussion'
  28. ];
  29. }