Beispiel #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $taxi = Taxi::findOrFail($id);
     $taxi->fill($request->all());
     $taxi->save();
     return \Redirect::route('taxis.index');
 }
Beispiel #2
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     if ($this->post->fill($input)->validate_post()) {
         $image = Input::file('attachment');
         if ($image->isValid()) {
             $path = 'uploads/posts/' . Auth::user()->username;
             $filename = 'posts-' . time() . rand(1000, 9999) . '.' . $image->getClientOriginalExtension();
             if ($image->move($path, $filename)) {
                 $data = $this->post->create(['user_id' => Auth::user()->id, 'title' => $input['title'], 'content' => $input['content'], 'attachment' => $filename]);
                 if ($data->id) {
                     $post = $this->post->find($data->id);
                     $post->tags()->attach($input['tags']);
                     Session::flash('type', 'success');
                     Session::flash('message', 'Post Created');
                     return Redirect::route('post.index');
                 } else {
                     Session::flash('type', 'error');
                     Session::flash('message', 'Error!!! Cannot create post');
                     return Redirect::back()->withInput();
                 }
             } else {
                 Session::flash('type', 'error');
                 Session::flash('message', 'Error!!! File cannot be uploaded');
                 return Redirect::back()->withInput();
             }
         } else {
             Session::flash('type', 'error');
             Session::flash('message', 'Error!!! File is not valid');
             return Redirect::back()->withInput();
         }
     } else {
         return Redirect::back()->withInput()->withErrors($this->post->errors);
     }
 }
 public function update($id)
 {
     $validator = Validator::make(array('slider' => Input::file('slider')), array("slider" => "image | mimes:jpeg, jpg, png, gif | max: 6000"), array('mimes' => '<span class="glyphicon glyphicon-remove"></span> Unknown file inserted', 'size' => '<span class="glyphicon glyphicon-exclamation-sign"></span> Size must be less than 6 MB'));
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     } else {
         if (Input::file('slider') != '') {
             $file = Input::file('slider');
             $name = date('i-G-Y') . $file->getClientOriginalName();
             $destination = 'assets/images/slider/';
             $file->move($destination, $name);
             $query = Slider::find($id);
             $query->slider = 'assets/images/slider/' . $name;
             $query->slider_text = Input::get('text');
             if ($query->save()) {
                 return Redirect::route('slider-page')->with('event', '<p class="alert alert-success"><span class="glyphicon glyphicon-ok"></span> Slider updated successfully</p>');
             } else {
                 return Redirect::back()->with('event', '<p class="alert alert-danger"><span class="glyphicon glyphicon-remove"></span> Error occured. Please try after sometime</p>');
             }
         } else {
             $query = Slider::find($id);
             $query->slider_text = Input::get('text');
             if ($query->save()) {
                 return Redirect::route('slider-page')->with('event', '<p class="alert alert-success"><span class="glyphicon glyphicon-ok"></span> Slider updated successfully</p>');
             } else {
                 return Redirect::back()->with('event', '<p class="alert alert-danger"><span class="glyphicon glyphicon-remove"></span> Error occured. Please try after sometime</p>');
             }
         }
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $fob = KeyFob::findOrFail($id);
     $fob->markLost();
     \Notification::success("Key Fob marked as lost/broken");
     return \Redirect::route('account.show', $fob->user_id);
 }
 public function addComment($groupId)
 {
     $input = \Input::all();
     $input['group_id'] = $groupId;
     CustomerGroupComment::create($input);
     return \Redirect::route('customer-groups.members', $groupId);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateEstudianteReqest $request)
 {
     $Est = new Estudiante($request->all());
     $Est->estado = 'A';
     $Est->save();
     return \Redirect::route('estudiantes.index');
 }
 /**
  * Removes all local galleries for the current user list.
  *
  * @return Response
  */
 public function destroyList()
 {
     $users = Input::get('users');
     $userIds = array_pluck($users, 'id');
     $removed = $this->gallery->destroyByUsers($userIds);
     return Redirect::route('users.index')->with('message', "Has been removed {$removed} galleries");
 }
Beispiel #8
0
 /**
  * POST /register
  *
  * @return \View
  * @throws \Report\Managers\ValidationException
  */
 public function register()
 {
     $manager = new RegisterManager($this->userRepo->newUser(), Input::all());
     $manager->save();
     Session::flash('message', 'register-sucess');
     return Redirect::route('sing-in');
 }
 public function getDeactivateApiKey($key)
 {
     $apiKey = \App\Models\ApiKey::find($key);
     $apiKey->active = 0;
     $apiKey->save();
     return \Redirect::route('settings.apiKeys.list');
 }
 public function store()
 {
     if ($_POST) {
         $input = Input::all();
         $rules = array('username' => 'required|unique:users', 'password' => 'required', 'email' => 'required|unique:users|email', 'firstname' => 'required|Alpha', 'lastname' => 'required|alpha_dash', 'city' => 'required', 'country' => 'required|Alpha', 'recaptcha_response_field' => 'required|recaptcha');
         $validator = Validator::make($input, $rules);
         if ($validator->fails()) {
             return Redirect::to('register')->withInput()->withErrors($validator);
         } else {
             $user = new User();
             $user->username = Input::get('username');
             $user->password = Hash::make(Input::get('password'));
             $user->firstname = Input::get('firstname');
             $user->lastname = Input::get('lastname');
             $user->email = Input::get('email');
             $user->city = Input::get('city');
             $user->country = Input::get('country');
             $user->organisation = Input::get('organisation');
             $user->description = Input::get('description');
             $user->picture = '';
             $user->suspended = 0;
             if (Input::hasFile('picture')) {
                 $file = Input::file('picture');
                 $pixpath = '/uploads/pix/user/';
                 $destinationPath = public_path() . $pixpath;
                 $filename = $user->username . '.' . $file->getClientOriginalExtension();
                 $file->move($destinationPath, $filename);
                 $user->picture = base64_encode($pixpath . $filename);
             }
             $user->save();
             return Redirect::to('login')->with('successmessage', trans('master.registersuccess'));
         }
     }
     return Redirect::route('register.index')->withInput()->withErrors($s->errors());
 }
 public function removeNews($id)
 {
     $news = News::find($id);
     $name = $news->title;
     $news->delete();
     return Redirect::route('account')->with('status', 'alert-success')->with('global', 'You just deleted ' . $name);
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create($username)
 {
     if (credentialsMatch($username)) {
         return View::make('posts.create', ['categories' => $this->categories]);
     }
     return Redirect::route('login');
 }
Beispiel #13
0
 /**
  *
  * @return nothing
  * @author Tremor
  */
 public function login()
 {
     if (Request::isMethod('post')) {
         $post = Input::all();
         $rules = ['email' => 'required|email', 'password' => 'required'];
         $validator = Validator::make($post, $rules);
         if ($validator->fails()) {
             $this->setMessage($validator->messages()->all(), 'error');
             return Redirect::route('login')->withInput();
         } else {
             $email = trim(Input::get('email'));
             $password = trim(Input::get('password'));
             $remember = Input::get('remember') == 1 ? true : false;
             if (Auth::attempt(array('email' => $email, 'password' => $password, 'is_admin' => 1))) {
                 return Redirect::route('admin');
             } elseif (Auth::attempt(array('email' => $email, 'password' => $password))) {
                 return Redirect::route('home');
             } else {
                 $this->setMessage('failed login', 'error');
                 return Redirect::route('login')->withInput();
             }
         }
     }
     return View::make('auth.signin')->with($this->data);
 }
 /**
  * Setup authorization based on returned server variables
  * from the IdP.
  */
 public function idpAuthorize()
 {
     $email = $this->getServerVariable(config('shibboleth.idp_login_email'));
     $first_name = $this->getServerVariable(config('shibboleth.idp_login_first'));
     $last_name = $this->getServerVariable(config('shibboleth.idp_login_last'));
     $password = str_random(100);
     if ($email) {
         $credentials = ['email' => $email];
         $user = Sentinel::findByCredentials($credentials);
         if ($user) {
             Sentinel::login($user);
         } else {
             // unable to find user, so now we check to see if new users are allowed to be added
             if (config('shibboleth.add_new_users', true)) {
                 // Add New user
                 $params = ['email' => $email, 'password' => $password, 'first_name' => $first_name, 'last_name' => $last_name];
                 $user = Sentinel::registerAndActivate($params);
                 // User starts as role: standard user
                 $account_type = 1;
                 // Find the role using the role name
                 $role = Sentinel::findRoleById($account_type);
                 // Assign the role to the users
                 $role->users()->attach($user);
                 Session::put('auth_type', 'idp');
                 return \Redirect::route('manage.posts.index')->with('success', 'User (and password) has been created successfully!');
             }
             return \Redirect::route('home')->with('warning', 'We are not accepting new users at this time');
         }
         Session::put('auth_type', 'idp');
         return $this->viewOrRedirect(config('shibboleth.shibboleth_authenticated'));
     } else {
         return $this->viewOrRedirect(config('shibboleth.login_fail'));
     }
 }
 /**
  * Store a newly created client in storage.
  *
  * @return Response
  */
 public function store($bookingId)
 {
     $user = Auth::user();
     $validator = Validator::make($data = Input::all(), Client::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $data['booking_id'] = $bookingId;
     if ($bookingdata = Client::create($data)) {
         $booking = Booking::getBookingData($bookingdata->booking_id);
         $pdf = PDF::loadView('emails/booking', array('booking' => $booking));
         $pdf->save(public_path() . '/temp-files/booking' . $booking->id . '.pdf');
         $emails = array('*****@*****.**', '*****@*****.**', '*****@*****.**');
         $ehi_users = User::getEhiUsers();
         Mail::send('emails/booking-mail', array('booking' => Booking::getBookingData($booking->id)), function ($message) use($booking, $emails, $ehi_users) {
             $message->attach(public_path() . '/temp-files/booking' . $booking->id . '.pdf')->subject('Amended Booking(Client Added): ' . $booking->reference_number)->from('*****@*****.**', 'SriLankaHotels.Travel')->bcc('*****@*****.**', 'Admin');
             foreach ($emails as $emailaddress) {
                 $message->to($emailaddress, 'Admin');
             }
             if (!empty($ehi_users)) {
                 foreach ($ehi_users as $ehi_user) {
                     $message->to($ehi_user->email, $ehi_user->first_name);
                 }
             }
         });
     }
     return Redirect::route('bookings.show', $bookingId);
 }
 public function update($id)
 {
     try {
         $product = Product::findOrFail($id);
         $img = Input::File('img');
         $description = Input::get('description');
         strip_tags($img);
         $rules = ['img' => 'mimes:jpg,jpeg,png,gif', 'description' => 'max:80'];
         $messages = array('mimes' => '¡Atención! Solo están permitidas imágenes en: jpg, png o gif.', 'max' => '¡Atención! Máximo :max caracteres de descripción');
         $validator = \Validator::make(['img' => $img, 'description' => $description], $rules, $messages);
         if ($validator->passes()) {
             if ($img) {
                 $filename = str_random(10) . '.' . $img->getClientOriginalName();
                 $destinationPath = public_path() . '/uploads/products/';
                 $uploadSuccess = $img->move($destinationPath, $filename);
                 $product->img = $filename;
             } else {
                 $product->img = $product['img'];
             }
             $product->name = Input::get('name');
             $product->description = Input::get('description');
             $product->price = Input::get('price');
             $product->updated_at = new DateTime();
             $product->update(['id']);
             return Redirect::route('products')->with('error', false)->with('msg', 'Producto actualizada con éxito.')->with('class', 'info');
         } else {
             return Redirect::back()->withErrors($validator);
         }
     } catch (Exception $exc) {
         echo $exc->getMessage() . " " . $exc->getLine();
         return Redirect::back()->with('error', true)->with('msg', '¡Algo salió mal! Contacte con administrador.')->with('class', 'danger');
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::only(['name', 'rank', 'email', 'myMessage', 'g-recaptcha-response']);
     $google_url = "https://www.google.com/recaptcha/api/siteverify";
     $secret = Config::get('recaptcha.secret_key');
     $url = $google_url . "?secret=" . $secret . "&response=" . $data['g-recaptcha-response'];
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $url);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($curl, CURLOPT_TIMEOUT, 10);
     curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.16) Gecko/20110319 Firefox/3.6.16");
     $curlData = curl_exec($curl);
     curl_close($curl);
     $response = json_decode($curlData, true);
     if ($response['success'] == true) {
         $rules = array('name' => 'required|min:3|max:100', 'rank' => 'required|min:3|max:50', 'email' => 'required|email|unique:users|unique:invitations', 'myMessage' => 'required|min:5|max:300');
         $validator = Validator::make($data, $rules);
         if ($validator->fails()) {
             return Redirect::route('admin.request.index')->withErrors($validator->messages());
         } else {
             Mail::send('emails.auth.request', $data, function ($message) {
                 $message->to('*****@*****.**', 'РегистърБГ')->subject('Нова заявка за покана в РегистърБГ');
                 $message->to('*****@*****.**', 'РегистърБГ')->subject('Нова заявка за покана в РегистърБГ');
             });
             if (count(Mail::failures()) > 0) {
                 return Redirect::route('admin.request.index')->withErrors(array('mainError' => 'Възникна грешка при изпращане на имейл. Моля опитайте по-късно.'));
             }
             return Redirect::route('admin.request.index')->withErrors(array('mainSuccess' => 'Заявката е успшно изпратена. Възможно най-бързо ще получите обратна връзка.'));
         }
     }
     return Redirect::route('admin.request.index')->withErrors(array('g-recaptcha-response' => 'Моля потвърдете, че не сте робот.'));
     /*return Redirect::route('admin.index');*/
 }
 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');
         }
     }
 }
 public function notFound()
 {
     if ($this->community and !$this->community->present()->canView()) {
         return \Redirect::route('communities');
     }
     return $this->theme->section('error-page');
 }
 public function inviteMember($member_id, $chatroom_id)
 {
     if ($this->checkInvited($member_id, $chatroom_id) == 'false') {
         InviteMember::updateInvitedMember($member_id, $chatroom_id);
     }
     return Redirect::route('join-room', array($chatroom_id));
 }
 public function postEdit($id)
 {
     if (!$this->checkRoute()) {
         return Redirect::route('index');
     }
     $title = 'Edit A Modpack Creator - ' . $this->site_name;
     $creator = Creator::find($id);
     $input = Input::only('name', 'deck', 'website', 'donate_link', 'bio', 'slug');
     $messages = ['unique' => 'The modpack creator already exists in the database.', 'url' => 'The :attribute field is not a valid URL.'];
     $validator = Validator::make($input, ['name' => 'required|unique:creators,name,' . $creator->id, 'website' => 'url', 'donate_link' => 'url'], $messages);
     if ($validator->fails()) {
         return Redirect::action('CreatorController@getAdd')->withErrors($validator)->withInput();
     }
     $creator->name = $input['name'];
     $creator->deck = $input['deck'];
     $creator->website = $input['website'];
     $creator->donate_link = $input['donate_link'];
     $creator->bio = $input['bio'];
     if ($input['slug'] == '' || $input['slug'] == $creator->slug) {
         $slug = Str::slug($input['name']);
     } else {
         $slug = $input['slug'];
     }
     $creator->slug = $slug;
     $creator->last_ip = Request::getClientIp();
     $success = $creator->save();
     if ($success) {
         return View::make('creators.edit', ['title' => $title, 'creator' => $creator, 'success' => true]);
     }
     return Redirect::action('CreatorController@getEdit', [$id])->withErrors(['message' => 'Unable to edit modpack creator.'])->withInput();
 }
 /**
  * Returns the "authenticated" view which simply shows the
  * authenticated user.
  *
  * @return mixed
  */
 public function getAuthenticated()
 {
     if (!Sentinel::check()) {
         return Redirect::to('oauth')->withErrors('Not authenticated yet.');
     }
     return Redirect::route('user.account')->withSuccess('Successfully logged in.');
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     $applicant = Applicant::find($id);
     $applicant->status = Input::get('status');
     $applicant->save();
     return \Redirect::route('applicants.index')->with('message', 'Applicant has been updated!');
 }
 public function desactivate($id)
 {
     $response = Response::findOrFail($id);
     $response->active = 0;
     $response->save();
     return Redirect::route('admin.questions.show', ['id' => $response->question->id])->with(['message' => 'Response desactivated successfully.']);
 }
Beispiel #25
0
 /**
  * Very basic authentication by checking a session variable
  *
  * @param $request
  * @param Closure $next
  * @return \Illuminate\Http\RedirectResponse
  */
 public function handle($request, Closure $next)
 {
     if (\Request::session()->get('connector.auth', false) !== true) {
         return \Redirect::route('connector.auth.login.get');
     }
     return $next($request);
 }
 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();
     }
 }
Beispiel #27
0
 public function registrarProfesor()
 {
     $new_profesor = new Profesor();
     $new_profesor->num_empleado = Input::get("num_empleado");
     $new_profesor->password = Input::get("password");
     $new_profesor->email = Input::get("email");
     $new_datos_profesor = new DatosProfesor();
     $new_datos_profesor->nombre = Input::get("nombre");
     $new_datos_profesor->apellido_paterno = Input::get("apellido_paterno");
     $new_datos_profesor->apellido_materno = Input::get("apellido_materno");
     $new_datos_profesor->sexo = Input::get("sexo");
     $new_datos_profesor->celular = Input::get("celular");
     // Pequeño hack. Primero lo ponemos como archivo para validarlo, después le asignamos la ruta real para guardarlo
     $new_datos_profesor->ruta = Input::file('cv');
     if ($new_profesor->validate()) {
         if ($new_datos_profesor->validate()) {
             $nombreCV = Input::get("nombre") . "_" . Input::get("apellido_paterno") . "_" . Input::get("apellido_materno") . "_CV.pdf";
             //CHECAR PORQUE NO SE CREA EL PUTO CV!!!
             Input::file('cv')->move("CVs", $nombreCV);
             $new_datos_profesor->ruta = "/CVs/" . $nombreCV;
             //Ahora si, guardamos todo después de haberlo validado
             $new_profesor->save();
             $new_datos_profesor->profesor()->associate($new_profesor);
             // Forzamos Save porque sabemos que no validará ruta como un string, sino como un file
             $new_datos_profesor->forceSave();
             return Redirect::to('/');
         } else {
             return Redirect::route('registro')->withErrors($new_datos_profesor->errors())->withInput();
         }
     } else {
         $new_datos_profesor->validate();
         $erroresValidaciones = array_merge_recursive($new_profesor->errors()->toArray(), $new_datos_profesor->errors()->toArray());
         return Redirect::route('registro')->withErrors($erroresValidaciones)->withInput();
     }
 }
 /**
  * Redirect back
  *
  * @param int $id
  * @return \Illuminate\Http\RedirectResponse
  */
 protected function readRedirect($topicType, $id)
 {
     $topic = $this->topicRepo->requireById($id);
     $forum = $this->forumRepo->requireById(last($topic->pathExplode()));
     return Redirect::route('forums.show', ['id' => $forum->id, 'slug' => $forum->slug]);
     return Redirect::to('/');
 }
 public function postUpload()
 {
     $agente = Agente::find(1);
     if (Input::hasFile('file')) {
         $file = Input::file('file');
         $name = $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension();
         $size = File::size($file);
         //dd($extension);
         $data = array('nombre' => $name, 'extension' => $extension, 'size' => $size);
         $rules = array('extension' => 'required|mimes:jpeg');
         $messages = array('required' => 'El campo :attribute es obligatorio.', 'min' => 'El campo :attribute no puede tener menos de :min carácteres.', 'email' => 'El campo :attribute debe ser un email válido.', 'max' => 'El campo :attribute no puede tener más de :max carácteres.', 'unique' => 'La factura ingresada ya está agregada en la base de datos.', 'confirmed' => 'Los passwords no coinciden.', 'mimes' => 'El campo :attribute debe ser un archivo de tipo :values.');
         $validation = Validator::make($rules, $messages);
         if ($validation->fails()) {
             return Redirect::route('logo-post')->withInput()->withErrors($validation);
         } else {
             if ($extension != 'jpg') {
                 return Redirect::route('logo-post')->with('global', 'Es necesario que la imagen sea de extension .jpg.');
             } else {
                 $path = public_path() . '/assets/img/';
                 $newName = 'logo';
                 $subir = $file->move($path, $newName . '.' . $extension);
                 return Redirect::route('agente.index')->with('create', 'El logo ha sido actualizado correctamente!');
             }
         }
     } else {
         return Redirect::route('logo-post')->with('global', 'Es necesario que selecciones una imagen.');
     }
 }
Beispiel #30
0
 public function getLogout()
 {
     if (Sentry::check()) {
         Sentry::logout();
         return Redirect::route('index');
     }
 }