示例#1
0
 public static function DataUsage($account_id)
 {
     $usage = Jsubs::where('account_id', '=', $account_id)->get()->first();
     if (count($usage) != 0) {
         $plan = $usage->plan;
         $total_usage = PlanChangeDetail::data_usage_in_gb($usage->bytes_total);
         return array("plan" => $plan, "usage" => $usage, "total_usage" => $total_usage);
     } else {
         $plan = 0;
         $total_usage = 0;
         return array("plan" => $plan, "usage" => $usage, "total_usage" => $total_usage);
     }
 }
示例#2
0
 public function data_usage_total_gb()
 {
     $usage = Jsubs::where('account_id', '=', $this->account_id)->get();
     if (count($usage) != 0) {
         $usage = $usage->first();
         $usage_bytes_in = $usage->bytes_up;
         $usage_bytes_out = $usage->bytes_down;
         $usage_total = (double) $usage_bytes_in + (double) $usage_bytes_out;
         $get_gb_percent = number_format((double) $usage_total, 2, '.', '');
         return $get_gb_percent;
     }
     return null;
 }
 public function notifyPassword($id)
 {
     $user = CusDet::where('account_no', '=', $id)->get()->first();
     if (!is_null($user)) {
         $temp_accout = TempAccountDetail::where('account_id', '=', $user->account_id)->get()->first();
         //var_dump($temp_accout); die;
         if ($temp_accout) {
             $password = $temp_accout->password;
         }
         $employee_id = Input::get('employee_id');
         $passwordChange = Input::get('password');
         if ($employee_id) {
             $employee = Employee::where('employee_identity', '=', $employee_id)->get()->first();
             $senderId = "OODOOS";
             $message = "Hi, User {$user->first_name} {$user->last_name} \n Account ID \n" . $user->account_id . "  \n Password \n" . $password;
             $mobileNumber = $employee->mobile;
         } else {
             if ($passwordChange) {
                 $new_password = $this->generateStrongPassword(7);
                 $jsubs = Jsubs::where('account_id', $user->account_id)->first();
                 if ($jsubs) {
                     $new_password_api = Api::japi_password_reset($jsubs->jaccount_no, $new_password);
                     $password_set = json_decode($new_password_api);
                     if ($password_set->status == "success") {
                         DB::table('temp_act_det')->where('account_id', $user->account_id)->update(array('password' => $new_password));
                         $password = $new_password;
                         $senderId = "OODOOP";
                         $message = "Hi, {$user->first_name} {$user->last_name} \n Your Account ID \n" . $user->account_id . "  \n Your Password \n" . $password . "  \n For any assistance please contact our customer care at +91 8940808080";
                         $mobileNumber = $user->phone;
                     } else {
                         Session::flash('message', 'Successfully Created');
                         return Redirect::back();
                     }
                 } else {
                     Session::flash('message', 'Successfully Created');
                     return Redirect::back();
                 }
             } else {
                 $email = $user->email;
                 $data = array('password' => $password, 'user' => $user);
                 Mail::send('emails.user_password_remainder', $data, function ($message) use($user, $email) {
                     $message->to($email, $user->first_name)->subject("Password Reminder");
                 });
                 $senderId = "OODOOP";
                 $message = "Hi, {$user->first_name} {$user->last_name} \n Your Account ID \n" . $user->account_id . "  \n Your Password \n" . $password . "  \n For any assistance please contact our customer care at +91 8940808080";
                 $mobileNumber = $user->phone;
             }
         }
         PaymentTransaction::sendsms($mobileNumber, $senderId, $message);
         Session::flash('message', 'Sent Successfully!');
         return Redirect::back();
     }
     Session::flash('message', 'Successfully Created');
     return Redirect::back()->with('success', 'Employee Not Found');
 }
示例#4
0
 public function jsubs($account_id)
 {
     $jsubs = Jsubs::where('account_id', '=', $account_id)->get()->first();
     return $jsubs;
 }