public function loginQR($size = 80)
 {
     if (!$this->login_token) {
         $this->entity->login_token = str_random(20);
         $this->entity->save();
     }
     return \QrCode::format('png')->size(200)->errorCorrection('L')->margin(0)->generate($this->github_name . ',' . $this->login_token);
 }
 private function sendMail($fullName, $toEmail, $orderId, $date, $sector, $quantity, $amount, $line, $encrypt)
 {
     $purchaseNumber = str_pad($orderId, 10, '0', STR_PAD_LEFT);
     $datePurchase = date('d/m/Y', strtotime($date));
     $qrFile = public_path('tmp\\' . $orderId . '.png');
     QrCode::format('png')->size(200)->generate($encrypt, $qrFile);
     Mail::queue('users.mails.test', array('fullName' => $fullName, 'purchaseNumber' => $purchaseNumber, 'datePurchase' => $datePurchase, 'sector' => $sector, 'quantity' => $quantity, 'amount' => $amount, 'line' => $line, 'qrFile' => $qrFile), function ($message) use($fullName, $toEmail) {
         $message->to($toEmail, $fullName)->cc('*****@*****.**', 'TICKETEG')->subject('Gracias por comprar con Tigo Money!');
     });
     File::delete($qrFile);
 }
 private function sendMail($toEmail, $orderId, $encrypt)
 {
     $purchaseNumber = str_pad($orderId, 10, '0', STR_PAD_LEFT);
     $qrFile = public_path('tmp\\[s]' . $orderId . '.png');
     QrCode::format('png')->size(200)->generate($encrypt, $qrFile);
     Mail::queue('users.mails.test-samsung', array('purchaseNumber' => $purchaseNumber, 'qrFile' => $qrFile), function ($message) use($toEmail) {
         $message->to($toEmail)->cc('*****@*****.**', 'TICKETEG')->subject('Recibiste una entrada adicional por cortesía de Samsung Club y Tigo!');
     });
     File::delete($qrFile);
 }
Example #4
0
 private function generateTickets(\App\Order $order, $payuResponse)
 {
     $order->data = json_encode($payuResponse);
     $order->status = 'success';
     $order->save();
     $carts = $this->user()->carts()->get();
     foreach ($carts as $cart) {
         $ticket = new \App\Ticket();
         $ticket->order_id = $order->id;
         $ticket->event_id = $cart->price->event->id;
         $ticket->price = $cart->price->value;
         $ticket->description = $cart->price->description;
         $ticket->quantity = $cart->quantity;
         $ticket->unique = '871fd7278c6b07b7a9777c42ab3a1a55' . md5($order->id) . md5($cart->price->event->id) . md5($cart->price->id);
         $ticket->save();
         \QrCode::format('png')->size(250)->generate($ticket->unique, public_path('qrcodes/' . $ticket->unique . '.png'));
     }
     $this->user()->carts()->delete();
     return true;
 }
Example #5
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     try {
         $rules = array('first_name' => 'required|min:2|max:20', 'last_name' => 'required|min:2|max:20', 'city' => 'required|max:50', 'pincode' => 'required|between:6,10');
         $messages = array('first_name.required' => 'First name is required.', 'last_name.required' => 'Last name is required.', 'city.required' => 'City is required.', 'pincode.required' => 'Pincode is required.');
         $validator = Validator::make(Input::all(), $rules, $messages);
         if ($validator->fails()) {
             $ers = json_decode($validator->messages()->toJson());
             $ermsg = "";
             foreach ($ers as $errs) {
                 foreach ($errs as $key => $value) {
                     $ermsg .= $value . "<br/>";
                 }
             }
             return $this->response(array('statusCode' => 400, 'statusDescription' => 'Bad Request', 'errors' => $ermsg));
         } else {
             $uid = Auth::id();
             if ($id == $uid) {
                 $user = Auth::user();
                 $user->fname = Input::get('first_name');
                 $user->lname = Input::get('last_name');
                 $user->address = Input::get('address');
                 $user->colony = Input::get('colony');
                 $user->area = Input::get('area');
                 $user->city = Input::get('city');
                 $user->pincode = Input::get('pincode');
                 $user->save();
                 $bike = Bike::where('user_id', '=', $uid)->where('status', '=', 0, 'AND')->orderBy('id', 'desc')->first();
                 if ($bike) {
                     $unique_id = $user->city . "-" . $user->pincode . "-";
                     for ($i = 0; $i < 11; $i++) {
                         $unique_id .= rand(0, 9);
                     }
                     $bike->unique_id = $unique_id;
                     $bike->status = 1;
                     $bike->qr_code = base64_encode(QrCode::format('png')->size(150)->encoding('UTF-8')->color(150, 90, 10)->backgroundColor(125, 184, '#808040')->generate($unique_id));
                     $bike->updatedon = date("Y-m-d H:i:s");
                     $bike->save();
                 }
                 return $this->response(array('statusCode' => 100, 'statusDescription' => 'Success', 'data' => $user));
             } else {
                 return $this->response(array('statusCode' => 400, 'statusDescription' => "Bad Request", "errors" => "You cannot change profile of others."));
             }
         }
     } catch (Exception $e) {
         return $this->response(array('statusCode' => 401, 'statusDescription' => "Bad Request", "errors" => $e->getMessage()));
     }
 }
 public function qr($hash)
 {
     $contents = \QrCode::format('png')->size(300)->generate('http://local.suaray.com/');
     $response = \Response::make($contents, 200);
     $response->header('Content-Type', 'image/png');
     return $response;
 }