public function postOwnerDetail()
 {
     $validator = Validator::make(Input::all(), array('full_name' => 'required|max:250', 'address' => 'required|max:250', 'city' => 'required|max:250', 'country' => 'required|max:250', 'email' => 'required|email|max:250', 'tele' => 'required|max:250', 'description' => 'required|max:600'));
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     } else {
         $fullname = Input::get('full_name');
         $address = Input::get('address');
         $city = Input::get('city');
         $country = Input::get('country');
         $email = Input::get('email');
         $tele = Input::get('tele');
         $mobile = Input::get('mobile');
         $description = Input::get('description');
         $mytime = Carbon\Carbon::now();
         $insertToHotelOwnerTable = DB::table('hotel_owner')->insert(['fullname' => $fullname, 'address' => $address, 'city' => $city, 'country' => $country, 'telephone' => $tele, 'mobile' => $mobile, 'email' => $email, 'details' => $description, 'company_id' => Auth::user()->comp_id, 'created_at' => $mytime->toDateTimeString(), 'updated_at' => $mytime->toDateTimeString()]);
         if ($insertToHotelOwnerTable) {
             $role = Auth::user()->role;
             switch ($role) {
                 case 'hotel-admin':
                     return Redirect::route('company-profile');
                     break;
                 case 'hotel-staff':
                     return Redirect::route('dashboard-logged-staff');
                     break;
             }
         } else {
             return Redirect::route('add-room');
         }
     }
 }
Example #2
0
 public function postNew()
 {
     $validation = new Validators\SeatUserRegisterValidator();
     if ($validation->passes()) {
         // Let's register a user.
         $user = new \User();
         $user->email = Input::get('email');
         $user->username = Input::get('username');
         $user->password = Hash::make(Input::get('password'));
         $user->tsid = Input::get('tsid');
         $user->activation_code = str_random(24);
         $user->activated = 1;
         $user->save();
         // Prepare data to be sent along with the email. These
         // are accessed by their keys in the email template
         $data = array('activation_code' => $user->activation_code);
         // Send the email with the activation link
         Mail::send('emails.auth.register', $data, function ($message) {
             $message->to(Input::get('email'), 'New SeAT User')->subject('SeAT Account Confirmation');
         });
         // And were done. Redirect to the login again
         return Redirect::action('SessionController@getSignIn')->with('success', 'Successfully registered a new account. Please check your email for the activation link.');
     } else {
         return Redirect::back()->withInput()->withErrors($validation->errors);
     }
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($this->auth->check()) {
         return \Redirect::back();
     }
     return $next($request);
 }
 /**
  * Unfollow a user
  *
  * @param $userIdToUnfollow
  * @return Response
  */
 public function destroy($userIdToUnfollow)
 {
     $input = array_add(Input::all(), 'userId', Auth::id());
     $this->execute(UnfollowUserCommand::class, $input);
     Flash::success("You have now unfollowed this user.");
     return Redirect::back();
 }
 public function getBaja($id)
 {
     $nota_credito = Cupon::find($id);
     $nota_credito->activo = 0;
     $nota_credito->save();
     return Redirect::back()->with('status', 'cupon_baja');
 }
Example #6
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $familia = Familia::findOrFail($id);
     $validator = Familia::validator(Input::all());
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $datos = Input::all();
     if (Input::file('foto')) {
         $file = Input::file('foto');
         $destinationPath = 'uploads/images/';
         $filename = Str::random(20) . '.' . $file->getClientOriginalExtension();
         $mimeType = $file->getMimeType();
         $extension = $file->getClientOriginalExtension();
         $upload_success = $file->move($destinationPath, $filename);
         if ($familia->foto != 'fam.jpg') {
             File::delete($destinationPath . $familia->foto);
         }
         $datos['foto'] = $filename;
     } else {
         unset($datos['foto']);
     }
     $familia->update($datos);
     Session::flash('message', 'Actualizado Correctamente');
     Session::flash('class', 'success');
     return Redirect::to('/dashboard/familia');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     //Validate
     $rules = array('name' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     // process the validation
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput(Input::except('password'));
     } else {
         // Update
         $commodity = Commodity::find($id);
         $commodity->name = Input::get('name');
         $commodity->description = Input::get('description');
         $commodity->metric_id = Input::get('unit_of_issue');
         $commodity->unit_price = Input::get('unit_price');
         $commodity->item_code = Input::get('item_code');
         $commodity->storage_req = Input::get('storage_req');
         $commodity->min_level = Input::get('min_level');
         $commodity->max_level = Input::get('max_level');
         try {
             $commodity->save();
             return Redirect::route('commodity.index')->with('message', trans('messages.success-updating-commodity'))->with('activecommodity', $commodity->id);
         } catch (QueryException $e) {
             Log::error($e);
         }
     }
 }
Example #8
0
 /**
  * 修改账户基本信息
  *
  * @return Response
  */
 public function postModify()
 {
     $data = Input::all();
     $userInfoType = Input::get('user_info_type');
     $user = Auth::user();
     switch ($userInfoType) {
         case USER_INFO_0:
             $rules = array('user_nickname' => 'max:64', 'user_email' => 'email');
             $validator = Validator::make($data, $rules);
             if ($validator->fails()) {
                 return Redirect::back()->withInput()->withErrors($validator);
             }
             $userNickName = Input::get('user_nickname');
             $userEmail = Input::get('user_email');
             $user->wy_nick_name = $userNickName;
             $user->wy_email = $userEmail;
             $result = $user->save();
             if ($result) {
                 return Redirect::back()->with('success', Lang::get('messages.10021'));
             } else {
                 $context = array("errorCode" => -15008, "userID" => $user->wy_user_id, "data" => $data);
                 Log::error(Lang::get('errormessages.-15008'), $context);
                 return Redirect::back()->withInput()->with('error', Lang::get('errormessages.-15008'));
             }
             break;
         case USER_INFO_1:
             break;
         default:
             $context = array("errorCode" => -10027, "userID" => $user->wy_user_id, "data" => $data);
             Log::error(Lang::get('errormessages.-10027'), $context);
             return Redirect::back()->with('error', Lang::get('errormessages.-10027'));
             break;
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function update($id)
 {
     // Get input and save into variable.
     $data = Input::all();
     // Validate input data.
     $val = AboutUs::validate($data);
     // If validator fails show errors to user.
     if ($val->fails()) {
         return Redirect::back()->withErrors($val);
     }
     // If no validation errors, update About Us information on database.
     $aboutus = AboutUs::find($id);
     $aboutus->title = Input::get('title');
     $aboutus->body = Input::get('body');
     // Get original data to compare if changes were made.
     $original = AboutUs::find($id);
     // Check if changes were made, if so, save to form, if no, redirect back with message.
     if ($original->title != $aboutus->title || $original->body != $aboutus->body) {
         $aboutus->save();
         // Redirect with success message.
         return Redirect::back()->with('message', FlashMessage::DisplayAlert('Information Updated Successfully!', 'success'));
     } else {
         // No changes were made, redirect back with warning message.
         return Redirect::back()->with('message', FlashMessage::DisplayAlert('Nothing to update. No changes made.', 'warning'));
     }
 }
Example #10
0
 public function postSettings()
 {
     // Hex RGB Custom Validator
     Validator::extend('hex', function ($attribute, $value, $parameters) {
         return preg_match("/^\\#[0-9A-Fa-f]{6}\$/", $value);
     });
     // Validation Rules
     $rules = ['nc-color' => 'required|hex', 'tr-color' => 'required|hex', 'vs-color' => 'required|hex', 'time-format' => 'required|in:12,24'];
     // Validation
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::back();
     }
     // Save Hex and Dark Hex colors to Session
     foreach (['nc', 'tr', 'vs'] as $faction) {
         $color = strtolower(Input::get("{$faction}-color"));
         // Chosen color
         Session::put("faction-colors.{$faction}.default", $color);
         // Color darkened by 50%
         Session::put("faction-colors.{$faction}.dark", $this->adjustColorLightenDarken($color, 50));
         // Outline color
         if ($color == Config::get("ps2maps.faction-colors.{$faction}.default")) {
             // If color is default color, use white outline
             $outline = "#FFF";
         } else {
             // Otherwise use calculated outline color
             $outline = $this->closerToBlackOrWhite(Input::get("{$faction}-color")) == "#FFF" ? "#000" : "#FFF";
         }
         Session::put("faction-colors.{$faction}.outline", $outline);
     }
     // Save time format to session
     Session::put('time-format', Input::get('time-format'));
     return Redirect::back()->with('message', 'Settings Saved');
 }
Example #11
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $regla = ['codigo' => 'required|max:6', 'apellidopaterno' => 'required', 'apellidomaterno' => 'required', 'nombre' => 'required'];
     $validacion = Validator::make($input, $regla);
     if ($validacion->fails()) {
         return Redirect::back()->withErrors($validacion);
     } else {
         $nombre = Input::get('nombre');
         $apellidopaterno = Input::get('apellidopaterno');
         $apellidomaterno = Input::get('apellidomaterno');
         $codigo = Input::get('codigo');
         if ($iddocente = Docente::where('codDocente', '=', $codigo)->first()) {
             $error = ['wilson' => 'El codigo ' . $codigo . '  ya existe'];
             return Redirect::back()->withInput()->withErrors($error);
         } else {
             if ($ddocente = Docente::where('nombre', '=', $nombre)->where('apellidoP', '=', $apellidopaterno)->where('apellidoM', '=', $apellidomaterno)->first()) {
                 $error = ['wilson' => 'Este docente ya ha sido insertado'];
                 return Redirect::back()->withInput()->withErrors($error);
             } else {
                 $Docente = new Docente();
                 $Docente->codDocente = Input::get('codigo');
                 $Docente->nombre = Input::get('nombre');
                 $Docente->apellidoM = Input::get('apellidomaterno');
                 $Docente->apellidoP = Input::get('apellidopaterno');
                 $Docente->categoria = Input::get('categoria');
                 $Docente->email = Input::get('email');
                 $Docente->codDptoAcademico = Input::get('iddepartamento');
                 $Docente->save();
                 return Redirect::to('docente/listar');
             }
         }
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function update($id)
 {
     $input = Input::all();
     $val = ContactUs::validate($input);
     if ($val->fails()) {
         return Redirect::back()->withErrors($val);
     }
     $contactus = ContactUs::find($id);
     $contactus->title = Input::get('title');
     $contactus->address = Input::get('address');
     $contactus->city = Input::get('city');
     $contactus->state = Input::get('state');
     $contactus->zip = Input::get('zip');
     $contactus->email_1 = Input::get('email_1');
     $contactus->email_2 = Input::get('email_2');
     $contactus->phone_1 = Input::get('phone_1');
     $contactus->phone_2 = Input::get('phone_2');
     // Original record
     $original = ContactUs::find($id);
     // If nothing changed do not make call to database and return with warning message.
     if ($original->title != $contactus->title || $original->address != $contactus->address || $original->city != $contactus->city || $original->state != $contactus->state || $original->zip != $contactus->zip || $original->email_1 != $contactus->email_1 || $original->email_2 != $contactus->email_2 || $original->phone_1 != $contactus->phone_1 || $original->phone_2 != $contactus->phone_2) {
         $contactus->save();
         return Redirect::back()->with('message', FlashMessage::DisplayAlert('Information Updated Successfully!', 'success'));
     }
     return Redirect::back()->with('message', FlashMessage::DisplayAlert('Nothing to update. No changes made.', 'warning'));
 }
 public function postSchimbaStadiu($id_livrabil)
 {
     $actualizare_ore = Input::get('ore_lucrate') > 0;
     $is_stadiu = Input::get('stadiu_selectionat') != null && Input::get('stadiu_selectionat') > 0;
     $array_update = array();
     if ($is_stadiu) {
         //Face insert in tabela de istoric de stadii
         //Actualizeaza stadiul livrabilului
         $array_update = array_add($array_update, 'id_stadiu', Input::get('stadiu_selectionat'));
     }
     if ($actualizare_ore) {
         //Actualizeaza numarul de ore lucrate la acest livrabil
         $array_update = array_add($array_update, 'ore_lucrate', Input::get('ore_lucrate'));
     }
     // Start transaction!
     DB::beginTransaction();
     if ($is_stadiu) {
         try {
             DB::table('istoric_stadii_livrabil')->insertGetId(array('id_livrabil_etapa' => Input::get('id_livrabil_etapa'), 'id_stadiu' => Input::get('stadiu_selectionat'), 'id_user' => Entrust::user()->id));
         } catch (Exception $e) {
             DB::rollback();
             return Redirect::back()->with('message', 'Eroare salvare date: ' . $e);
         }
     }
     if ($is_stadiu || $actualizare_ore) {
         try {
             DB::table('livrabile_etapa')->where('id', Input::get('id_livrabil_etapa'))->update($array_update);
         } catch (Exception $e) {
             DB::rollback();
             return Redirect::back()->with('message', 'Eroare salvare date: ' . $e);
         }
     }
     DB::commit();
     return Redirect::back()->with('message', 'Actualizare realizata cu succes!')->withInput();
 }
 /**
  * Store a newly created resource in storage.
  * POST /sessions
  *
  * @return Response
  */
 public function store()
 {
     if (Auth::attempt(Input::only('email', 'password'))) {
         return Redirect::to('/reservation');
     }
     return Redirect::back();
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     // var_dump(Input::All());
     // die;
     //
     // 'categorias_id' => 'exists:rubros,id'
     $rules = ['articulo' => 'required', 'copete' => 'required', 'texto' => 'required'];
     if (!Articulo::isValid(Input::all(), $rules)) {
         return Redirect::back()->withInput()->withErrors(Articulo::$errors);
     }
     $articulo = new Articulo();
     $articulo->users_id = Sentry::getUser()->id;
     $articulo->articulo = Input::get('articulo');
     $articulo->copete = Input::get('copete');
     $articulo->texto = Input::get('texto');
     $articulo->tipo = Input::get('tipo');
     $articulo->categorias_id = Input::get('categorias_id');
     $url_seo = Input::get('articulo');
     $articulo->estado = 'nuevo';
     //$url_seo = $this->url_slug($url_seo) . implode("-",getdate());
     $url_seo = $this->url_slug($url_seo) . date('ljSFY');
     $articulo->url_seo = $url_seo;
     $articulo->save();
     return Redirect::to('/articulos/ver');
 }
 public function postRecharge()
 {
     try {
         $voucher_type = Input::get('voucher_type', NULL);
         $pin = Input::get('pin', NULL);
         if ($voucher_type == NULL) {
             throw new Exception("Select Voucher Type.");
         }
         if ($pin == NULL) {
             throw new Exception("Please enter a valid PIN");
         }
         switch ($voucher_type) {
             case 'prepaid':
                 Recharge::viaPin($pin, Auth::id());
                 $this->notifySuccess('Recharge Successful.');
                 break;
             case 'refill':
                 Refillcoupons::viaPin($pin, Auth::id());
                 $this->notifySuccess('Refill Applied.');
                 break;
         }
         return Redirect::route(self::HOME);
     } catch (Exception $e) {
         $this->notifyError($e->getMessage());
         return Redirect::back();
     }
 }
Example #17
0
 public static function autoResponse($url = 'back', $statut = 'error', $message = '', $options = array())
 {
     if (Request::ajax()) {
         $data = array();
         // Options
         if (!empty($options)) {
             $data = $options;
         }
         // Statut
         if ($statut == 'error') {
             $statut = 'danger';
         }
         $data['statut'] = $statut;
         $data['message'] = $message;
         // Response
         return Response::json($data);
     } else {
         if ($url == 'back') {
             if ($statut == 'validator') {
                 return Redirect::back()->withInput()->withErrors($message);
             } else {
                 return Redirect::back()->with($statut, $message);
             }
         } else {
             if ($statut == 'validator') {
                 return Redirect::to($url)->withInput()->withErrors($message);
             } else {
                 return Redirect::to($url)->with($statut, $message);
             }
         }
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::all();
     $rules = array('cedula' => 'unique:pacientes,cedula');
     $validator = Validator::make(array('cedula' => $data['cedula']), $rules);
     if ($validator->fails()) {
         return Redirect::back()->withInput()->withErrors($validator);
     } else {
         $paciente = new Paciente();
         $paciente->primer_nombre = $data['primer_nombre'];
         $paciente->segundo_nombre = $data['segundo_nombre'];
         $paciente->primer_apellido = $data['primer_apellido'];
         $paciente->segundo_apellido = $data['segundo_apellido'];
         $paciente->cedula = $data['cedula'];
         $paciente->sexo = $data['sexo'];
         $paciente->id_tipo_sangre = $data['id_tipo_sangre'];
         $paciente->fecha_nacimiento = $data['fecha_nacimiento'];
         $paciente->ocupacion = $data['ocupacion'];
         $paciente->diabetes = $data['diabetes'];
         $paciente->clasificacion = $data['clasificacion'];
         $paciente->examen = $data['examen'];
         $paciente->referido_por = $data['referido_por'];
         $paciente->observaciones = $data['observaciones'];
         $paciente->direccion = $data['direccion'];
         $paciente->telefono = $data['telefono'];
         $paciente->celular = $data['celular'];
         $paciente->email = $data['email'];
         $paciente->save();
         return Redirect::route('datos.pacientes.index');
     }
 }
Example #19
0
 public function postSignin()
 {
     // 凭证
     $credentials = array('account' => Input::get('account'), 'pwd' => Input::get('pwd'));
     // 是否记住登录状态
     $remember = Input::get('remember-me', 0);
     // 获取所有表单数据.
     $data = Input::all();
     // 创建验证规则
     $rules = array('account' => 'required|alpha', 'pwd' => 'required|alpha_dash|between:5,16');
     // 自定义验证消息
     $messages = array('account.required' => '请输入帐号。', 'account.alpha' => '请输入正确的帐号,帐号必须全部由字母字符构成。', 'password.required' => '请输入密码。', 'password.alpha_dash' => '密码格式不正确。', 'password.between' => '密码长度请保持在:min到:max位之间。');
     // 开始验证
     $validator = Validator::make($data, $rules, $messages);
     if ($validator->passes()) {
         $admin = $this->model;
         // 验证登录
         if ($admin->hasLogin($credentials)) {
             // 登录成功,跳回之前被拦截的页面
             $path = Session::get('url.intended', "/admin");
             if ($path === '/auth/admin') {
                 return Redirect::to("/admin");
             }
             return Redirect::to($path);
         } else {
             // 登录失败,跳回
             return Redirect::back()->withInput()->with('error', '“用户”或“密码”错误,请重新登录。');
         }
     } else {
         // 验证失败,跳回
         return Redirect::back()->withInput()->withErrors($validator);
     }
 }
 /**
  * Stores new account
  *
  * @return  Illuminate\Http\Response
  */
 public function store()
 {
     $repo = App::make('UserRepository');
     $user = $repo->signup(Input::all());
     if ($user->id) {
         if (Config::get('confide::signup_email')) {
             Mail::queueOn(Config::get('confide::email_queue'), Config::get('confide::email_account_confirmation'), compact('user'), function ($message) use($user) {
                 $message->to($user->email, $user->first_name)->subject(Lang::get('confide::confide.email.account_confirmation.subject'));
             });
         }
         return Redirect::action('UsersController@login')->with('notice', Lang::get('confide::confide.alerts.account_created'));
     } else {
         $error = $user->errors()->all(':message');
         return Redirect::action('UsersController@create')->withInput(Input::except('password'))->with('error', $error);
     }
     $input = array('image' => Input::file('image'));
     $rules = array('image' => 'image');
     $validator = Validator::make($input, $rules);
     if ($validator->fails()) {
         return Redirect::back()->withInput()->withErrors($e->getErrors());
     } else {
         $file = Input::file('image');
         $name = time() . '-' . $file->getClientOriginalName();
         $file = $file->move('uploads/', $name);
         $input['file'] = '/public/uploads/' . $name;
     }
 }
Example #21
0
 public function destroy($id)
 {
     $user = User::findOrFail($id);
     $user->delete();
     Flash::success('User ' . $user->name . ' deleted!');
     return \Redirect::back();
 }
 /**
  * Update the specified powerful in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $powerful = Powerful::findOrFail($id);
     $rules = array('name' => 'required', 'icon' => 'image');
     $validator = Validator::make($data = Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     //upload powerful icon
     if (Input::hasFile('icon')) {
         //delete old icon
         if (File::exists($powerful->icon)) {
             File::delete($powerful->icon);
         }
         //create new icon
         $name = md5(time() . Input::file('icon')->getClientOriginalName()) . '.' . Input::file('icon')->getClientOriginalExtension();
         $folder = "public/uploads/powerful";
         Input::file('icon')->move($folder, $name);
         $path = $folder . '/' . $name;
         //update new path
         $data['icon'] = $path;
     } else {
         unset($data['icon']);
     }
     $powerful->update($data);
     return Redirect::route('admin.powerful.index')->with('message', 'Item had updated!');
 }
Example #23
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $lskill = new Lskill();
     // skill Model 内容
     $lskill->name_jp = Input::get('name_jp');
     $lskill->name_en = Input::get('name_en');
     $lskill->name_cn = Input::get('name_cn');
     $lskill->desc_jp = Input::get('desc_jp');
     $lskill->desc_en = Input::get('desc_en');
     $lskill->desc_cn = Input::get('desc_cn');
     $lskill->race = Input::get('race');
     $lskill->attr = Input::get('attr');
     $lskill->job = Input::get('job');
     $lskill->power = Input::get('power');
     $lskill->power_type = Input::get('power_type');
     $lskill->admin_memo = Input::get('admin_memo');
     // 原则上做成时非公开
     $lskill->open = false;
     // $lskill->update_datetime = now();
     if ($lskill->save()) {
         return Redirect::to('skill');
     } else {
         return Redirect::back()->withInput()->withErrors('保存失败!');
     }
 }
Example #24
0
 /**
  * Log in to site.
  *
  * @return Response
  */
 public function login()
 {
     if (Auth::attempt(array('email' => Input::get('email'), 'password' => Input::get('password')), true) || Auth::attempt(array('username' => Input::get('email'), 'password' => Input::get('password')), true)) {
         return Redirect::intended('dashboard');
     }
     return Redirect::back()->withInput(Input::except('password'))->with('message', 'Wrong creadentials!');
 }
Example #25
0
 function store()
 {
     $rules = array('icao' => 'alpha_num|required', 'iata' => 'alpha_num', 'name' => 'required', 'city' => 'required', 'lat' => 'required|numeric', 'lon' => 'required|numeric', 'elevation' => 'required|numeric', 'country_id' => 'required|exists:countries,id', 'website' => 'url');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         Messages::error($validator->messages()->all());
         return Redirect::back()->withInput();
     }
     if (is_null($airport = Airport::whereIcao(Input::get('icao'))->whereNew(true)->first())) {
         $airport = new Airport();
         $airport->icao = Input::get('icao');
         $airport->name = Input::get('name');
         $airport->new = true;
         $airport->save();
     }
     Diff::compare($airport, Input::all(), function ($key, $value, $model) {
         $change = new AirportChange();
         $change->airport_id = $model->id;
         $change->user_id = Auth::id();
         $change->key = $key;
         $change->value = $value;
         $change->save();
     }, ['name', 'iata', 'city', 'country_id', 'lat', 'lon', 'elevation', 'website']);
     Messages::success('Thank you for your submission. We will check whether all information is correct and soon this airport might be available.');
     return Redirect::back();
 }
Example #26
0
 public function postRegister()
 {
     $validationRules = array('email' => 'required|email|unique:users', 'password' => 'required|min:8|confirmed', 'type' => 'required');
     $formValidator = Validator::make(Input::all(), $validationRules);
     if ($formValidator->passes()) {
         // creatting new user
         $createUser = new User();
         $createUser->email = Input::get('email');
         $createUser->type = Input::get('type');
         $createUser->password = Hash::make(Input::get('password'));
         $createUser->status = 'OFF';
         $createUser->save();
         // checking to create if user is patient or physician
         if ($createUser->type == 'PHYSICIAN') {
             $createPhysisician = new Physician();
             $createPhysisician->user_id = $createUser->id;
             $createPhysisician->save();
         }
         if ($createUser->type == 'PATIENT') {
             $createPatient = new Patient();
             $createPatient->user_id = $createUser->id;
             $createPatient->save();
         }
         return Redirect::to('user/login')->with('success', ' Account created, please login');
     } else {
         return Redirect::back()->withInput()->withErrors($formValidator);
     }
 }
Example #27
0
 public function store()
 {
     if (Auth::attempt(Input::only('username', 'password'))) {
         return Redirect::route('users.show', Auth::user()->username);
     }
     return Redirect::back()->withInput()->withErrors(array('password' => 'Invalid Password or username'));
 }
Example #28
0
 public function delete($id)
 {
     $historia = Historia::find($id);
     $historia->delete();
     Session::flash('message', 'Noticia Borrada');
     return Redirect::back();
 }
 /**
  * Upload the file and store
  * the file path in the DB.
  */
 public function store()
 {
     // Rules
     $rules = array('name' => 'required', 'file' => 'required|max:20000');
     $messages = array('max' => 'Please make sure the file size is not larger then 20MB');
     // Create validation
     $validator = Validator::make(Input::all(), $rules, $messages);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $directory = "uploads/files/";
     // Before anything let's make sure a file was uploaded
     if (Input::hasFile('file') && Request::file('file')->isValid()) {
         $current_file = Input::file('file');
         $filename = Auth::id() . '_' . $current_file->getClientOriginalName();
         $current_file->move($directory, $filename);
         $file = new Upload();
         $file->user_id = Auth::id();
         $file->project_id = Input::get('project_id');
         $file->name = Input::get('name');
         $file->path = $directory . $filename;
         $file->save();
         return Redirect::back();
     }
     $upload = new Upload();
     $upload->user_id = Auth::id();
     $upload->project_id = Input::get('project_id');
     $upload->name = Input::get('name');
     $upload->path = $directory . $filename;
     $upload->save();
     return Redirect::back();
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $rules = array('patient_number' => 'required|unique:patients,patient_number', 'name' => 'required', 'gender' => 'required', 'dob' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput(Input::all());
     } else {
         // store
         $patient = new Patient();
         $patient->patient_number = Input::get('patient_number');
         $patient->name = Input::get('name');
         $patient->gender = Input::get('gender');
         $patient->dob = Input::get('dob');
         $patient->email = Input::get('email');
         $patient->address = Input::get('address');
         $patient->phone_number = Input::get('phone_number');
         $patient->created_by = Auth::user()->id;
         try {
             $patient->save();
             $url = Session::get('SOURCE_URL');
             return Redirect::to($url)->with('message', 'Successfully created patient!');
         } catch (QueryException $e) {
             Log::error($e);
         }
         // redirect
     }
 }