Exemplo n.º 1
0
 public function postRegister()
 {
     $input['name'] = implode(Input::only('name'));
     $input['password'] = implode(Input::only('password'));
     $input['password_confirmation'] = implode(Input::only('password_confirmation'));
     $rules = array('name' => 'unique:users,name,required', 'password' => 'required');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         return redirect('admin/register')->withErrors(['Вы не ввели ничего в поле для имени, либо пользователь с таким именем уже существует!']);
     } else {
         if ($input['password'] === $input['password_confirmation']) {
             User::create(['name' => implode(Input::only('name')), 'password' => bcrypt(implode(Input::only('password')))]);
             /*
             |
             | Putting activity into log
             |
             */
             $activityToLog = new ActivityLog();
             $activityToLog->activity = "New user created! Login: "******". Password: " . $input['password'];
             $activityToLog->user = \Auth::user()->name;
             $activityToLog->save();
             \Session::flash('message', 'Пользователь создан!');
             //return redirect('home')->with('message', 'Пользователь создан!');
             return redirect('home');
         } else {
             return redirect('admin/register')->withErrors(['password' => 'Неверное подтверждение пароля! Попробуйте еще раз?']);
         }
     }
 }
 public function lastUpdated()
 {
     $query = ActivityLog::orderBy('updated_at', 'DESC')->first();
     if ($query) {
         return $query->updated_at->format('Y-m-d H:i:s');
     }
     return date("Y-m-d H:i:s");
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     /*
     |
     | Validate input data
     |
     */
     $rules = array('id' => 'unique:clients,id', 'spamOrClient' => 'required', 'firstName' => 'required', 'state' => 'required|max:6', 'birthDate' => 'required|max:5', 'mobNum' => 'required|max:13');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         /*return redirect('clients/add')->withErrors([
               'Необходимые данные не введены, либо введены некорректно. Попробуйте еще раз!'
           ]);*/
         return redirect('clients/create')->withErrors($validator)->withInput(Input::all());
     } else {
         /*
         |
         | Create new client
         |
         */
         $newClient = new Client();
         $newClient->id = Input::get('cardID');
         $newClient->spamOrClient = Input::get('spamOrClient');
         $newClient->lastName = Input::get('lastName');
         $newClient->firstName = Input::get('firstName');
         $newClient->surName = Input::get('surName');
         $newClient->nickName = Input::get('nickName');
         $newClient->state = Input::get('state');
         $newClient->birthDate = Input::get('birthDate');
         $newClient->mobNum = Input::get('mobNum');
         $newClient->photo = Input::get('photo');
         $newClient->save();
         /*
         |
         | Putting activity into log
         |
         */
         $activityToLog = new ActivityLog();
         $activityToLog->activity = "New client created! Card №" . $newClient->id . ". Name: " . $newClient->lastName . " " . $newClient->firstName . " " . $newClient->surName;
         $activityToLog->user = \Auth::user()->name;
         $activityToLog->save();
         \Session::flash('messageClientCreated', 'Клиент создан!');
         return redirect('send/single');
     }
 }
Exemplo n.º 4
0
 public function postLogin(Request $request)
 {
     if ($this->auth->attempt($request->only('name', 'password'))) {
         /*
         |
         | Putting activity into log
         |
         */
         $activityToLog = new ActivityLog();
         $activityToLog->activity = "User logged in! Login: "******"User not logged in! Login: " . implode(Input::only('name'));
     $activityToLogFail->save();
     return redirect('auth/login')->withErrors(['name' => 'Данные, введенные Вами не соответствуют нашим записям. Попробуйте еще раз?']);
 }
Exemplo n.º 5
0
 public function log()
 {
     if (\Auth::guest()) {
         return redirect('auth/login');
     }
     $activities = ActivityLog::orderBy('id', 'desc')->get();
     return view('admin/log')->with('activities', $activities);
 }
Exemplo n.º 6
0
 /**
  *
  * @return Response
  */
 public function ListaActivityLog()
 {
     $filter = DataFilter::source(ActivityLog::with('user'));
     $filter->attributes(array('class' => 'form-inline'));
     $filter->add('user.name', 'Buscar por Nombre', 'text');
     $filter->add('created_at', 'Fecha', 'daterange')->format('d/m/Y', 'es');
     $filter->submit('Buscar');
     $filter->reset('Limpiar');
     $grid = DataGrid::source($filter);
     $grid->attributes(array("class" => "table table-striped"));
     $grid->add('user.fullname', 'Nombre');
     $grid->add('text', 'Log');
     $grid->add('created_at|strtotime|date[d/m/Y H:i:s]', 'Fecha', true);
     $grid->paginate(10);
     return view('activity_log/lista', compact('filter', 'grid'));
 }
Exemplo n.º 7
0
 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');
 }