public function actionDetails($quote) { $chat = new Chat(); if ($chat->load(Yii::$app->request->post())) { $use = new User(); $user = Yii::$app->user->identity->username; $val = $use->findByUsername1($user); $chat->user_id = $val->id; $chat->request_id = $quote; $reqs = Carrequest::find()->where('id=:id', array('id' => $quote))->one(); $chat->dealer_id = $reqs->dealer_id; $chat->sent = 2; if ($chat->save()) { $chat->message = ""; return $this->render('detail', ['quote' => $quote]); } } return $this->render('detail', ['quote' => $quote]); }