TestCastsModel.php 942 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Siam
  5. * Date: 2020/6/4
  6. * Time: 16:13
  7. */
  8. namespace EasySwoole\ORM\Tests\models;
  9. use EasySwoole\ORM\AbstractModel;
  10. /**
  11. * Class TestCastsModel
  12. * @package EasySwoole\ORM\Tests
  13. * @property $id
  14. * @property $name
  15. * @property $age
  16. * @property $addTime
  17. * @property $state
  18. *
  19. * @property $test_json
  20. * @property $test_array
  21. * @property $test_date
  22. * @property $test_datetime
  23. * @property $test_string
  24. *
  25. */
  26. class TestCastsModel extends AbstractModel
  27. {
  28. protected $tableName = 'test_user_model';
  29. protected $casts = [
  30. 'age' => 'int',
  31. 'id' => 'float',
  32. 'addTime' => 'timestamp',
  33. 'state' => 'bool',
  34. // 在join中自定义的
  35. 'test_json' => 'json',
  36. 'test_array' => 'array',
  37. 'test_date' => 'date',
  38. 'test_datetime' => 'datetime',
  39. 'test_string' => 'string',
  40. ];
  41. }