Test.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace App\Module\Game\Models;
  3. use App\Module\Game\Database\Factories\TestFactory;
  4. use Illuminate\Database\Eloquent\Factories\HasFactory;
  5. use UCore\ModelCore;
  6. use Illuminate\Database\Eloquent\SoftDeletes;
  7. use App\Module\Game\Events\TestEvent;
  8. /**
  9. * App\Module\Game\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 $dates = [
  48. 'created_at',
  49. 'updated_at',
  50. 'deleted_at'
  51. ];
  52. /**
  53. * 属性类型转换
  54. *
  55. * @var array
  56. */
  57. protected $casts = [
  58. 'data' => 'array',
  59. 'status' => 'integer'
  60. ];
  61. /**
  62. * 创建一个新的工厂实例
  63. *
  64. * @return \Illuminate\Database\Eloquent\Factories\Factory
  65. */
  66. protected static function newFactory()
  67. {
  68. return TestFactory::new();
  69. }
  70. }