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.

79 lines
1.8 KiB

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