255], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'user_id' => 'User ID', 'uid' => 'Uid', 'mall_id' => 'Mall ID', 'type' => 'Type', 'id_no' => 'Id No', 'id_img' => 'Id Img', 'id_back_img' => 'Id Back Img', 'is_real' => 'Is Real', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } public function getUser() { return $this->hasOne(User::class, ['id' => 'user_id']); } public static function setData($params) { try { if(isset($params['id']) && !empty($params['id'])) $model = self::findOne($params['id']); elseif(isset($params['user_id']) && !empty($params['type'])) $model = self::findOne(['user_id' => $params['user_id'], 'type' => $params['type']]); if (!$model) { $model = new self(); $model->loadDefaultValues(); } if (!$model->load($params, '') || !$model->save()) { throw new \Exception($model->getErrorMessage()); } return $model; } catch (\Exception $e) { self::$static_error = $e->getMessage(); return false; } } }