FileStorageConfigHistory.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace App\Module\File\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. /**
  5. * 存储配置历史记录模型
  6. *
  7. * field start
  8. * @property int $id 主键
  9. * @property int $config_id 关联的存储配置ID
  10. * @property string $old_driver 旧存储驱动
  11. * @property string $new_driver 新存储驱动
  12. * @property string $old_config 旧配置值
  13. * @property string $new_config 新配置值
  14. * @property int $old_status 旧状态
  15. * @property int $new_status 新状态
  16. * @property string $changed_at 变更时间
  17. * @property int $changed_by 变更人ID
  18. * @property string $change_reason 变更原因
  19. * @property \Carbon\Carbon $created_at 创建时间
  20. * @property \Carbon\Carbon $updated_at 更新时间
  21. * field end
  22. */
  23. class FileStorageConfigHistory extends Model
  24. {
  25. /**
  26. * 表名
  27. */
  28. protected $table = 'file_storage_config_histories';
  29. /**
  30. * 主键
  31. */
  32. protected $primaryKey = 'id';
  33. /**
  34. * 可批量赋值的字段
  35. */
  36. protected $fillable = [
  37. 'config_id',
  38. 'old_driver',
  39. 'new_driver',
  40. 'old_config',
  41. 'new_config',
  42. 'old_status',
  43. 'new_status',
  44. 'changed_by',
  45. 'change_reason'
  46. ];
  47. /**
  48. * 类型转换
  49. */
  50. protected $casts = [
  51. 'old_config' => 'array',
  52. 'new_config' => 'array',
  53. 'old_status' => 'boolean',
  54. 'new_status' => 'boolean'
  55. ];
  56. /**
  57. * 自动维护时间戳
  58. */
  59. public $timestamps = false;
  60. /**
  61. * 关联的存储配置
  62. */
  63. public function config()
  64. {
  65. return $this->belongsTo(FileStorageConfig::class, 'config_id');
  66. }
  67. }