You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
1.8 KiB

  1. <?php
  2. namespace backend\models\ars;
  3. use Yii;
  4. use yii\behaviors\TimestampBehavior;
  5. /**
  6. * This is the model class for table "ats_taking_site".
  7. *
  8. * @property int $id
  9. * @property string $name 名称
  10. * @property int $updated_at 更新时间
  11. * @property int $created_at 创建时间
  12. * @property string $province 省份
  13. * @property string $city 城市
  14. * @property string $area 区域
  15. * @property string $address 地址
  16. */
  17. class TakingSite extends \yii\db\ActiveRecord
  18. {
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public static function tableName()
  23. {
  24. return 'ats_taking_site';
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function rules()
  30. {
  31. return [
  32. [['name', 'province', 'city', 'area', 'address'], 'required'],
  33. [['address'], 'string'],
  34. [['name'], 'string', 'max' => 120],
  35. [['province', 'city', 'area'], 'string', 'max' => 64],
  36. ];
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function attributeLabels()
  42. {
  43. return [
  44. 'id' => 'id',
  45. 'name' => '名称',
  46. 'updated_at' => '更新时间',
  47. 'created_at' => '创建时间',
  48. 'province' => '省份',
  49. 'city' => '城市',
  50. 'area' => '区域',
  51. 'address' => '地址',
  52. ];
  53. }
  54. /**
  55. * @author linyao
  56. * @email 602604991@qq.com
  57. * @created Nov 8, 2019
  58. *
  59. * 行为存储创建时间和更新时间
  60. */
  61. public function behaviors()
  62. {
  63. return [
  64. [
  65. 'class' => TimestampBehavior::className(),
  66. 'createdAtAttribute' => 'created_at',
  67. 'updatedAtAttribute' => 'updated_at',
  68. 'value' => function() {
  69. return time();
  70. },
  71. ],
  72. ];
  73. }
  74. }