예제 #1
0
 /**
  * Signs user up.
  *
  * @return User|null the saved model or null if saving fails
  */
 public function signup()
 {
     if ($this->validate()) {
         $query2 = (new Query())->select('username')->from('user')->where('city=:city AND dealer=:deal', array(':city' => $this->city, ':deal' => 1));
         $dealer = $query2->all();
         $flag = 1;
         $car = $this->model_name;
         $use = new User();
         $user = Yii::$app->user->identity->username;
         $val = $use->findByUsername($user);
         $color = $this->color;
         $variant = $this->variant;
         $city = $this->city;
         $otherr = $this->otherr;
         $delivery = $this->delivery;
         $urequest = new Userrequest();
         $urequest->car_model = $car;
         $urequest->user_id = $val->id;
         $urequest->username = $val->username;
         $urequest->color = $color;
         $urequest->variant = $variant;
         $urequest->city = $city;
         $urequest->otherr = $otherr;
         $urequest->delivery = $delivery;
         $urequest->save();
         \Yii::$app->mailer->compose(['html' => 'request-html'], ['user' => $val, 'req' => $urequest])->setFrom([\Yii::$app->params['supportEmail'] => 'motormetric' . ' robot'])->setTo($val->email)->setSubject('Your Request ' . $urequest->car_model)->send();
         foreach ($dealer as $deal) {
             $request = new Carrequest();
             $val1 = $use->findByUsername1($deal['username']);
             $request->car_model = $car;
             $request->user_id = $val->id;
             $request->user_name = $val->username;
             $request->dealer_name = $deal['username'];
             $request->color = $color;
             $request->variant = $variant;
             $request->city = $city;
             $request->dealer_id = $val1->id;
             $request->request_id = $urequest->id;
             $request->otherr = $urequest->otherr;
             \Yii::$app->mailer->compose(['html' => 'requestd-html'], ['user' => $val, 'req' => $urequest, 'deal' => $val1])->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name])->setTo($val1->email)->setSubject('New Request ' . $urequest->car_model)->send();
             if (!$request->save()) {
                 $flag = 0;
             }
         }
         if ($flag) {
             $request = new Carrequest();
             return $request;
         }
         return null;
         //$user->username = $this->username;
     }
 }
예제 #2
0
 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]);
 }
예제 #3
0
파일: dash.php 프로젝트: vaibhavk01/motor
<th>Color</th>
<th>Delivery</th>
<th>On-Road Price</th>
<th>Quote	Specification</th>

</tr>




<?php 
if (count($rows) > 0) {
    foreach ($rows as $row) {
        echo "<tr>";
        $car = Car::find()->where('id=:id', array('id' => $row->car_id))->one();
        $reqs = Carrequest::find()->where('request_id=:id', array('id' => $row->id))->all();
        if (count($reqs) > 0) {
            foreach ($reqs as $req) {
                if ($req->status == 1) {
                    $reply = Reply::find()->where('request_id=:id', array('id' => $req->id))->one();
                    echo "<td>" . $row->id . "</td>";
                    echo "<td>" . $req->dealer_id . "</td>";
                    echo "<td>" . $car->model . "</td>";
                    echo "<td>" . $car->model_name . "</td>";
                    echo "<td>" . $car->fuel . "</td>";
                    echo "<td>" . $car->variant . "</td>";
                    echo "<td>" . $row->color . "</td>";
                    echo "<td>" . $row->delivery . "</td>";
                    if (count($reply) > 0) {
                        echo "<td><b>" . $reply->price . "</b></td>";
                        $data = explode(",", $reply->feature);