100], [['type'], 'string', 'max' => 50], [['goods_name', 'pic_url'], 'string', 'max' => 255], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'Mall ID', 'store_id' => 'store_id', 'type' => 'type', 'user_id' => 'User ID', 'buy_user_id' => 'Buy User ID', 'goods_id' => 'Goods ID', 'order_id' => 'Order ID', 'order_detail_id' => 'Order Detail ID', 'num' => 'Num', 'order_no' => 'Order No', 'money' => 'Money', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } public function getBuyUser() { return $this->hasOne(User::class, ['id' => 'buy_user_id']); } public static function add(array $params) { try { $model = new self(); $model->loadDefaultValues(); if (!$model->load($params, '')) throw new \Exception($model->getErrorMessage()); if (!$model->save()) throw new \Exception($model->getErrorMessage()); return $model; } catch (\Exception $e) { self::$static_error = $e->getMessage(); return false; } } }