public function actionDataHistory() { if (Yii::$app->request->isAjax) { $serviceClient = new Client(); $response = $serviceClient->getContent('http://sports.williamhill.com/bet/en-gb/betting/y/5/tm/Football.html'); $parser = new Parser(); $dataLive = $parser->run($response); if (!History::saveInHistory($dataLive)) { $dataHistory = []; } else { $dataHistory = History::find()->orderBy('date DESC')->limit(15)->all(); } echo $this->renderPartial('table', ['dataHistory' => $dataHistory]); exit; } }