SortingOrderGoods.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * InventoryOrderGoods.php
  4. * todo 文件描述
  5. * Created on 2024/3/26 10:33
  6. * @author: hankaige
  7. */
  8. namespace app\models;
  9. use yii\behaviors\TimestampBehavior;
  10. use yii\db\ActiveRecord;
  11. /**
  12. * This is the model class for table "{{%sorting_list}}".
  13. * @property integer $id
  14. * @property integer $sorting_id
  15. * @property integer $goods_id
  16. * @property string $goods_name
  17. * @property string $attr
  18. * @property integer $num
  19. * @property integer $created_at
  20. * @property integer $updated_at
  21. * @property integer $is_delete
  22. */
  23. class SortingOrderGoods extends \yii\db\ActiveRecord
  24. {
  25. public static function tableName()
  26. {
  27. return "{{%sorting_order_goods}}";
  28. }
  29. public function behaviors()
  30. {
  31. return [
  32. [
  33. 'class' => TimestampBehavior::class,
  34. 'attributes' => [
  35. ActiveRecord::EVENT_BEFORE_INSERT => ['created_at'],
  36. ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at']
  37. ]
  38. ]
  39. ];
  40. }
  41. public function rules()
  42. {
  43. return [
  44. [
  45. [
  46. 'sorting_id',
  47. 'goods_id',
  48. 'num',
  49. ],
  50. 'integer'
  51. ],
  52. [
  53. [
  54. 'goods_name',
  55. 'attr'
  56. ],
  57. 'string'
  58. ],
  59. [
  60. [
  61. 'sorting_id',
  62. 'goods_id',
  63. 'num',
  64. 'goods_name',
  65. 'attr'
  66. ],
  67. 'required'
  68. ]
  69. ];
  70. }
  71. public function attributeLabels()
  72. {
  73. return [
  74. 'sorting_id' => '备货单ID',
  75. 'goods_id' => '商品ID',
  76. 'num' => '商品数量',
  77. 'goods_name' => '商品名称',
  78. 'attr' => '规格',
  79. ];
  80. }
  81. public function getGoods()
  82. {
  83. return $this->hasOne(Goods::className(),['id'=>'goods_id']);
  84. }
  85. }