/** * Store a newly created resource in storage. * * @return Response */ public function store() { $rules = array('name' => 'unique:users,name,required', 'password' => 'required'); $validator = Validator::make(\Input::all(), $rules); if ($validator->fails()) { return redirect('admin/create')->withErrors(['Вы не ввели ничего в поле для имени, либо пользователь с таким именем уже существует!']); } else { if (Input::get('password') === Input::get('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::get('password'); $activityToLog->user = \Auth::user()->name; $activityToLog->save(); \Session::flash('message', 'Пользователь создан!'); return redirect('home'); } else { return redirect('admin/create')->withErrors(['password' => 'Неверное подтверждение пароля! Попробуйте еще раз?']); } } }
/** * 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'); } }
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' => 'Данные, введенные Вами не соответствуют нашим записям. Попробуйте еще раз?']); }
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'); }