Example #1
0
 /**
  * Update the specified resource in storage.
  *
  * @return \Illuminate\Http\Response
  */
 public function update(ClientRequest $request, $slug)
 {
     $client = Client::where(compact('slug'))->firstOrFail();
     $client_request = $request->except('tabs');
     $client->update($client_request);
     Toastr::success("Saved changes");
     $tabs = explode(':', $request->get('tabs'));
     return redirect('/client/' . $client->slug . '/' . $tabs[0] . '/' . $tabs[1]);
 }
Example #2
0
 public function getclients()
 {
     $start = Input::get('start', Date::now()->format('date'));
     $end = Input::get('end', Date::now()->format('date'));
     $client = Client::where('clientid', '=', Input::get('Client'))->first();
     $tjobs = Job::select(array('jobid', 'name', 'starttime', 'endtime', 'level', 'jobbytes', 'jobfiles', 'jobstatus'))->where('clientid', '=', $client->clientid)->where('starttime', '>=', $start)->where('endtime', '<=', $end);
     switch (Input::get('type')) {
         case "terminated":
             $tjobs->where('jobstatus', '=', 'T');
             break;
         case "running":
             $tjobs->where('jobstatus', '=', 'R');
             break;
         case "watting":
             $tjobs->wherein('jobstatus', array('c', 'F', 'j', 'M', 'm', 'p', 's', 't'));
             break;
         case "error":
             $tjobs->wherein('jobstatus', array('e', 'f', 'E'));
             break;
         case "cancel":
             $tjobs->where('jobstatus', '=', 'A');
             break;
     }
     return Datatables::of($tjobs)->edit_column('name', '{{ link_to_route("jobs", $name ,array("Job" => $jobid)) }} ')->edit_column('jobid', '{{ link_to_route("jobs", $jobid ,array("Job" => $jobid)) }} ')->make();
 }
 public function postMultiple()
 {
     /*
     |
     | Getting information from user
     |
     */
     $userInfo = array();
     foreach (\Input::all() as $key => $value) {
         $userInfo[$key] = $value;
     }
     //var_dump($userInfo);
     $message = $userInfo['holidayText'];
     $state = $userInfo['state'];
     $spamOrClient = $userInfo['spamOrClient'];
     //echo $message;
     //echo $state;
     //echo $spamClient;
     /*
     |
     | Connecting to the turbosms api via soap connection
     |
     */
     $client = new SoapClient('http://turbosms.in.ua/api/wsdl.html');
     $auth = array('login' => 'bandson', 'password' => '031194vela');
     $result = $client->Auth($auth);
     //echo $result->AuthResult . ' ';
     /*
     |
     | Setting appropriate data
     |
     */
     $ruleMaleClient = ['state' => 'male', 'spamOrClient' => 'client'];
     $ruleMaleSpam = ['state' => 'male', 'spamOrClient' => 'spam'];
     $ruleMaleAll = ['state' => 'male'];
     $ruleFemaleClient = ['state' => 'female', 'spamOrClient' => 'client'];
     $ruleFemaleSpam = ['state' => 'female', 'spamOrClient' => 'spam'];
     $ruleFemaleAll = ['state' => 'female'];
     $ruleAllClient = ['spamOrClient' => 'client'];
     $ruleAllSpam = ['spamOrClient' => 'spam'];
     if ($state == "male") {
         $str = '';
         if ($spamOrClient == "spam") {
             $client = Client::where($ruleMaleSpam)->get();
             //echo $client;
         } else {
             if ($spamOrClient == "client") {
                 $client = Client::where($ruleMaleClient)->get();
                 //echo $client;
             } else {
                 if ($spamOrClient == "spCl") {
                     $client = Client::where($ruleMaleAll)->get();
                     //echo $client;
                 }
             }
         }
         foreach ($client as $row) {
             $str = $str . ',' . $row->mobNum;
         }
         $telephones = substr($str, 1);
         //echo $telephones;
     } else {
         if ($state == "female") {
             $str = '';
             if ($spamOrClient == "spam") {
                 $client = Client::where($ruleFemaleSpam)->get();
                 //echo $client;
             } else {
                 if ($spamOrClient == "client") {
                     $client = Client::where($ruleFemaleClient)->get();
                     //echo $client;
                 } else {
                     if ($spamOrClient == "spCl") {
                         $client = Client::where($ruleFemaleAll)->get();
                         //echo $client;
                     }
                 }
             }
             foreach ($client as $row) {
                 $str = $str . ',' . $row->mobNum;
             }
             $telephones = substr($str, 1);
             //echo $telephones;
         } else {
             if ($state == "all") {
                 $str = '';
                 if ($spamOrClient == "spam") {
                     $client = Client::where($ruleAllSpam)->get();
                     //echo $client;
                 } else {
                     if ($spamOrClient == "client") {
                         $client = Client::where($ruleAllClient)->get();
                         //echo $client;
                     } else {
                         if ($spamOrClient == "spCl") {
                             $client = Client::all();
                             //echo $client;
                         }
                     }
                 }
                 foreach ($client as $row) {
                     $str = $str . ',' . $row->mobNum;
                 }
                 $telephones = substr($str, 1);
                 //echo $telephones;
             }
         }
     }
     $sms = array('sender' => 'Bandson', 'destination' => $telephones, 'text' => $message);
     //var_dump($sms);
     /*
     |
     | Sending SMS
     |
     */
     //$res=$client->SendSMS($sms);
     //echo $res->SendSMSResult->ResultArray[0] . '
     //';
     /*
     |
     | Putting activity into log
     |
     */
     $activityToLog = new ActivityLog();
     $activityToLog->activity = "Sent multiple SMS! Turbosms Login: "******". Destination: " . $sms['destination'] . ". Message: " . $sms['text'];
     $activityToLog->user = \Auth::user()->name;
     $activityToLog->save();
     \Session::flash('messageSentMult', 'Сообщения отправлены!');
     return redirect('/send/multiple');
 }