Test.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. namespace App\Module\Test\Models;
  3. use App\Module\Test\Database\Factories\TestFactory;
  4. use Illuminate\Database\Eloquent\Factories\HasFactory;
  5. use UCore\ModelCore;
  6. use Illuminate\Database\Eloquent\SoftDeletes;
  7. use App\Module\Test\Events\TestEvent;
  8. /**
  9. * App\Module\Test\Models\Test
  10. *
  11. * field start
  12. * @property int $id
  13. * @property string $name 名称
  14. * @property string $code 编码
  15. * @property string $description 描述
  16. * @property object|array $data 数据
  17. * @property int $status 状态:0禁用 1启用
  18. * @property \Carbon\Carbon $created_at
  19. * @property \Carbon\Carbon $updated_at
  20. * @property \Carbon\Carbon $deleted_at
  21. * field end
  22. */
  23. class Test extends ModelCore
  24. {
  25. use HasFactory, SoftDeletes;
  26. /**
  27. * 与模型关联的表名
  28. *
  29. * @var string
  30. */
  31. protected $table = 'test';
  32. // attrlist start
  33. protected $fillable = [
  34. 'id',
  35. 'name',
  36. 'code',
  37. 'description',
  38. 'data',
  39. 'status',
  40. ];
  41. // attrlist end
  42. /**
  43. * 可批量赋值的属性
  44. *
  45. * @var array
  46. */
  47. protected $fillable = [
  48. 'name',
  49. 'code',
  50. 'description',
  51. 'data',
  52. 'status'
  53. ];
  54. /**
  55. * 应该被调整为日期的属性
  56. *
  57. * @var array
  58. */
  59. protected $dates = [
  60. 'created_at',
  61. 'updated_at',
  62. 'deleted_at'
  63. ];
  64. /**
  65. * 属性类型转换
  66. *
  67. * @var array
  68. */
  69. protected $casts = [
  70. 'data' => 'array',
  71. 'status' => 'integer'
  72. ];
  73. /**
  74. * 创建一个新的工厂实例
  75. *
  76. * @return \Illuminate\Database\Eloquent\Factories\Factory
  77. */
  78. protected static function newFactory()
  79. {
  80. return TestFactory::new();
  81. }
  82. }