Test.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace App\Module\Transaction\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. class Test extends ModelCore
  9. {
  10. use HasFactory, SoftDeletes;
  11. /**
  12. * 与模型关联的表名
  13. *
  14. * @var string
  15. */
  16. protected $table = 'test';
  17. /**
  18. * 可批量赋值的属性
  19. *
  20. * @var array
  21. */
  22. protected $fillable = [
  23. 'name',
  24. 'code',
  25. 'description',
  26. 'data',
  27. 'status'
  28. ];
  29. /**
  30. * 应该被调整为日期的属性
  31. *
  32. * @var array
  33. */
  34. protected $dates = [
  35. 'created_at',
  36. 'updated_at',
  37. 'deleted_at'
  38. ];
  39. /**
  40. * 属性类型转换
  41. *
  42. * @var array
  43. */
  44. protected $casts = [
  45. 'data' => 'array',
  46. 'status' => 'integer'
  47. ];
  48. /**
  49. * 创建一个新的工厂实例
  50. *
  51. * @return \Illuminate\Database\Eloquent\Factories\Factory
  52. */
  53. protected static function newFactory()
  54. {
  55. return TestFactory::new();
  56. }
  57. }