/** * Display the specified resource. * * @param NA * @return NA */ public function requestLogin() { // validate the info, create rules for the inputs $rules = array('user_email' => 'required|email', 'password' => 'required|min:4'); // run the validation rules on the inputs from the form $validator = Validator::make(Input::all(), $rules); // if the validator fails, redirect back to the form if ($validator->fails()) { return Redirect::to(URL::previous())->withErrors($validator)->withInput(Input::except('password')); // send back the input (not the password) so that we can repopulate the form } else { // create our user data for the authentication $user_array = array('user_email' => $this->getInput('user_email', ''), 'password' => $this->getInput('password', '')); // attempt to do the login if (Auth::attempt($user_array)) { $current_password = $this->getInput('password', ''); // additional validation to make sure that password matched $user = Auth::user(); if (Hash::check($current_password, $user->password)) { return Redirect::intended('check'); } } else { Input::flash(); Session::flash('error_message', 'Invalid email or password, please try again'); $this->data['has_error'] = ERROR; return View::make('session.login')->with('data', $this->data); } } }
public function SendEmail() { /* * validate the Inputs sent */ $rules = array('email_cc' => "required_if:email_to,''|required_if:email_bcc,''", 'email_to' => "required_if:email_cc,''|required_if:email_bcc,''", 'email_bcc' => "required_if:email_cc,''|required_if:email_to,''", 'message' => 'required', 'subject' => 'required'); $messages = array("required_without" => "Please select atleast one recipient", "subject.required" => "Please enter message subject", "message.required" => "Please enter message to send"); $validator = Validator::make(Input::all(), $rules, $messages); $messages = $validator->messages(); if ($validator->fails()) { return Redirect::to(URL::previous())->withErrors($validator)->withInput(); } else { if (Conversation::saveEmail()) { Session::flash('_feedback', '<div class="alert alert-info alert-dismissable"> <i class="fa fa-info"></i> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><b>Alert!</b> Email has been successfully queued for sending</div>'); //Helpers::uploadCampaignFile(Input::file('attachment'), $attachment_ref); return Redirect::to(URL::route('conversation')); } else { Session::flash('_feedback', '<div class="alert alert-info alert-dismissable"> <i class="fa fa-info"></i> <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><b>Alert!</b> Error occured, please try again later</div>'); return Redirect::to(URL::route('conversation')); } } }
public function faqSend() { $question = new Question(); $input = Input::all(); $captcha_string = Input::get('g-recaptcha-response'); $captcha_response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=6LcCwgATAAAAAKaXhPJOGPTBwX-n2-PPLZ7iupKj&response=' . $captcha_string); $captcha_json = json_decode($captcha_response); if ($captcha_json->success) { $rules = ["sujetQuestion" => "required", "mail" => "required|email", "contenuQuestion" => "required"]; $messages = ["required" => ":attribute est requis pour l'envoi d'une question", "email" => "L'adresse email précisée n'est pas valide"]; $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { $messages = $validator->messages(); Session::flash('flash_msg', "Certains champs spécifiés sont incorrects."); Session::flash('flash_type', "fail"); return Redirect::to(URL::previous())->withErrors($validator); } else { $question->fill($input)->save(); Session::flash('flash_msg', "Votre question nous est bien parvenue. Nous vous répondrons sous peu."); Session::flash('flash_type', "success"); return Redirect::to(URL::previous()); } } else { Session::flash('flash_msg', "Champ de vérification incorrect ou non coché."); Session::flash('flash_type', "fail"); return Redirect::to(URL::previous()); } }
public function guardarPerfil() { //Campos $nombresApellidos = e(Input::get('nombresApellidos')); $telefono = e(Input::get('telefono')); $edad = e(Input::get('edad')); $correo = e(Input::get('correo')); $genero = e(Input::get('genero')); //Reglas $rules = array('nombresApellidos' => 'required|regex:/^([a-zA-z])/', 'edad' => 'regex:/^([0-9])/', 'telefono' => 'regex:/^([0-9])/', 'correo' => 'regex:/^([a-zA-Z0-9])+@espoch.edu.ec/', 'genero' => 'in:Masculino,Femenino'); //Mensajes $messages = array('required' => 'El campo :attribute es obligatorio', 'correo' => 'El campo :attribute debe ser un email institucional', 'in' => 'Seleccione una opción válida', 'unique' => 'El correo electrónico ya fue registrado'); $validation = Validator::make(Input::all(), $rules, $messages); if ($validation->fails()) { return Redirect::to(URL::previous())->withInput()->withErrors($validation); } else { $usuario = User::find(Auth::User()->id); $usuario->nombres_usuario = $nombresApellidos; $usuario->telefono_usuario = $telefono; $usuario->edad_usuario = $edad; $usuario->correo_usuario = $correo; $usuario->genero_usuario = $genero; $usuario->save(); return Redirect::to(URL::previous())->with('mensaje', 'Perfil Actualizado Corrrectamente'); } }
public function post() { // Only permit logged in users to comment if (Auth::check()) { // Add a rule to verify the particular item exists Validator::extend('itemExists', function ($attribute, $value, $parameters) { $type = ucfirst(Input::get('type')); $item = $type::find($value); return $item; }); // Validate the data $validator = Validator::make(Input::all(), array('id' => 'itemExists', 'type' => 'in:doctor,companion,enemy,episode', 'title' => 'required|min:5', 'email' => 'required|email', 'content' => 'required'), array('required' => 'You forgot to include the :attribute on your comment!', 'itemExists' => 'If you can see this, the universe is broken because that ' . Input::get('type') . ' does not exist.')); if ($validator->fails()) { return Redirect::to(URL::previous() . '#comments')->withErrors($validator)->withInput(); } else { $comment = new Comment(); $comment->user_id = Auth::id(); $comment->item_id = Input::get('id'); $comment->item_type = Input::get('type'); $comment->title = Input::get('title'); $comment->content = Input::get('content'); $comment->save(); return Redirect::to(URL::previous() . '#comments')->with('message', 'Comment posted'); } } }
public function actualizarMisionVision() { $response = 0; $id_centro = e(Input::get('id_centro')); $mision_centro = e(Input::get('mision_centro')); $vision_centro = e(Input::get('vision_centro')); $quienes_somos_centro = e(Input::get('quienes_somos_centro')); $centro = Centro::buscar_centro($id_centro); if (!is_null(Input::file('img_centro'))) { $file_img_vieja = $centro->img_centro; $file_img_centro = Input::file('img_centro'); $img_centro = $file_img_centro->getClientOriginalName(); } else { $img_centro = $centro->img_centro; } $response = Centro::actualizar_centro_mision_vision_quienes($id_centro, $mision_centro, $vision_centro, $quienes_somos_centro, $img_centro); if ($response == 1) { if (!is_null(Input::file('img_centro'))) { $file_img_centro->move('img', $file_img_centro->getClientOriginalName()); File::delete('img/' . $file_img_vieja); } return Redirect::to(URL::previous())->with('mensaje', 'Centro de Investigacion Actualizado Insertado Correctamente'); } else { return Redirect::to(URL::previous())->with('mensaje', 'Ha ocurrido un error'); } }
/** * Tracking Referals. * * */ protected function trackingReferrals() { $past = \URL::previous(); if (!str_contains($past, url())) { $this->trackingToFile('referrals', array($past)); } }
public function contactSend() { $data = ["nom" => Input::get('nom'), "prenom" => Input::get('prenom'), "email" => Input::get('email'), "message" => Input::get('message'), "sujet" => Input::get('sujet')]; $rules = array('email' => 'required', 'message' => 'required', 'sujet' => 'required'); $messages = array('required' => ':attribute est requis pour nous contacter', 'max' => "Le résumé de l'info trafic est trop long, 255 caractères max.", 'email' => "L'adresse email fournie n'est pas valide."); $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { $messages = $validator->messages(); return Redirect::to(URL::previous())->withErrors($validator); } else { $captcha_string = Input::get('g-recaptcha-response'); $captcha_response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=6LcCwgATAAAAAKaXhPJOGPTBwX-n2-PPLZ7iupKj&response=' . $captcha_string); $captcha_json = json_decode($captcha_response); if ($captcha_json->success) { Mail::send('emails.contact', $data, function ($message) { $message->from('*****@*****.**', 'sujet du message'); $message->to('*****@*****.**', 'Linéa Gap')->subject('Sujet du message !'); }); Session::flash('flash_msg', "Message bien envoyé."); Session::flash('flash_type', "success"); return Redirect::to(URL::previous()); } else { Session::flash('flash_msg', "Champ de validation incorrect."); Session::flash('flash_type', "fail"); return Redirect::to(URL::previous()); } } }
public function __construct() { $this->userIp = class_exists('\\Illuminate\\Support\\Facades\\Request') ? \Request::getClientIp() : $_SERVER['REMOTE_ADDR']; $this->userAgent = class_exists('\\Illuminate\\Support\\Facades\\Request') ? \Request::server('HTTP_USER_AGENT') : $_SERVER['HTTP_USER_AGENT']; $this->referrer = class_exists('\\Illuminate\\Support\\Facades\\URL') ? \URL::previous() : $_SERVER['HTTP_REFERER']; $this->permalink = class_exists('\\Illuminate\\Support\\Facades\\Request') ? \Request::url() : $_SERVER['REQUEST_URI']; }
/** * Change the application language. * * @param string * @return Response */ public function changeApplicationLanguage($code) { if ($language = \App\Language::whereCode($code)->first()) { event('language.change', $language); } return redirect(\URL::previous() ?: route('home')); }
public function updateChauffeur($id) { $chauffeur = Chauffeur::find($id); $input = ["nomChauffeur" => Input::get('nomChauffeur'), "prenomChauffeur" => Input::get('prenomChauffeur'), "loginChauffeur" => Input::get('loginChauffeur'), "password1" => Input::get('password1'), "password2" => Input::get('password2'), "mdpChauffeur" => sha1(Input::get('mdpChauffeur'))]; $messages = array('required' => ":attribute est requis pour l'ajout d'un nouveau chauffeur.", 'unique' => ':attribute est déjà utilisé', 'same' => 'Les mots de passe ne correspondent pas', 'min' => "Le mot de passe entré est trop court (5 car. mini)"); if (!empty(Input::get('password1'))) { $rules = array('password1' => 'required|same:password2|min:5', 'password2' => 'required'); $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { $messages = $validator->messages(); return Redirect::to(URL::previous())->withErrors($validator); } else { Session::flash('flash_msg', "Le mot de passe a bien été changé."); Session::flash('flash_type', "success"); $chauffeur->fill($input)->save(); return Redirect::to("/admin/chauffeurs"); } } else { $rules = array('nomChauffeur' => 'required', 'prenomChauffeur' => 'required'); // Si le login a été changé if (Input::get('loginChauffeur') != $chauffeur->loginChauffeur) { $rules['loginChauffeur'] = 'required|unique:chauffeur,loginChauffeur'; } $validator = Validator::make(Input::all(), $rules, $messages); if ($validator->fails()) { $messages = $validator->messages(); return Redirect::to(URL::previous())->withErrors($validator); } else { Session::flash('flash_msg', "Le informations personnelles ont bien été changées."); Session::flash('flash_type', "success"); $chauffeur->fill($input)->save(); return Redirect::to("/admin/chauffeurs"); } } }
public static function setBestLanguage($lang) { $root = Request::root(); $ruroot = $root . '/ru'; $enroot = $root . '/en'; $deroot = $root . '/de'; $url = URL::previous(); // Session::put('seg', $url); $request = parse_url($url, PHP_URL_PATH); $parse_array = explode("/", $request); // превращаю в массив if (in_array('login', $parse_array) or in_array('sign-up', $parse_array) or in_array('map', $parse_array)) { if (in_array('ru', $parse_array) or in_array('en', $parse_array) or in_array('de', $parse_array)) { $request = ltrim($request, '/ruden'); $myurl = $root . '/' . $lang . '/' . $request; } else { $myurl = $root . '/' . $lang . $request; } } elseif ($url == $ruroot or $url == $enroot or $url == $deroot or $url == "{$root}/") { $myurl = $root . '/' . $lang; } else { $myurl = $url; //Session::put('seg', $url); } return $myurl; }
public function clearAll() { $this->notificationRepository->clearAll(); if (!\Request::ajax()) { return \Redirect::to(\URL::previous()); } }
public function setBest(Request $request, $id) { $comment = ActivityComment::findOrFail($id); $comment->isbest = $request->input('value'); $comment->save(); return redirect(URL::previous()); }
public function dispatchRequest() { if (Input::get('findLA')) { if (empty(Input::get('ligne')) && empty(Input::get('arret'))) { Session::flash('flash_msg', "Vous n'avez pas sélectionné de ligne ou d'arrêt."); Session::flash('flash_type', "fail"); return Redirect::to(URL::previous()); } else { return $this->findByLigneArret(); } } if (Input::get('findL')) { if (empty(Input::get('ligne'))) { Session::flash('flash_msg', "Vous n'avez pas sélectionné de ligne."); Session::flash('flash_type', "fail"); return Redirect::to(URL::previous()); } else { return $this->findByLigne(); } } if (Input::get('findA')) { if (empty(Input::get('arret'))) { Session::flash('flash_msg', "Vous n'avez pas sélectionné d'arrêt."); Session::flash('flash_type', "fail"); return Redirect::to(URL::previous()); } else { return $this->findByArret(); } } }
public function lock() { $prevURL = URL::previous(); if (Request::ajax()) { $admin = Auth::admin()->get(); if (!Input::has('password')) { $message = 'You must enter password to re-login.'; } else { if (Hash::check(Input::get('password'), $admin->password)) { Session::forget('lock'); Session::flash('flash_success', 'Welcome back.<br />You has been login successful!'); return ['status' => 'ok']; } $message = 'Your password is not correct.'; } return ['status' => 'error', 'message' => $message]; } else { if (Request::isMethod('get')) { Session::put('lock', true); } } if (empty($prevURL) || strpos($prevURL, '/admin/lock') !== false) { $prevURL = URL . '/admin'; } return Redirect::to($prevURL); }
public function save () { $param = Input::all(); $validator = Validator::make($param, [ 'site_title' => 'required', 'meta_description' => 'required', 'meta_keywords' => 'required', 'email_support' => 'required|email', 'count_pagination' => 'required' ]); if ( $validator->fails() ) { $output = ''; $errors = $validator->messages()->toArray(); foreach ($errors as $error) { $output .= $error[0] . '<br>'; } return View::make('admin.elements.error')->with('errors', $output); } AppSettings::set('site_title', $param['site_title']); AppSettings::set('meta_description', $param['meta_description']); AppSettings::set('meta_keywords', $param['meta_keywords']); AppSettings::set('email_support', $param['email_support']); AppSettings::set('count_pagination', $param['count_pagination']); return Redirect::to(URL::previous()); }
public function newComment() { // POST İLE GÖNDERİLEN DEĞERLERİ ALALIM. $postData = Input::all(); // FORM KONTROLLERİNİ BELİRLEYELİM $rules = array('question_id' => 'required|integer', 'comment' => 'required'); // HATA MESAJLARINI OLUŞTURALIM $messages = array('question_id.required' => 'İşleminiz yapılırken teknik bir sorun oluştu', 'question_id.integer' => 'İşleminiz yapılırken teknik bir sorun oluştu', 'comment.required' => 'Lütfen yanıtınızı yazın'); // KONTROL (VALIDATION) İŞLEMİNİ GERÇEKLEŞTİRELİM $validator = Validator::make($postData, $rules, $messages); // EĞER VALİDASYON BAŞARISIZ OLURSA HATALARI GÖSTERELİM if ($validator->fails()) { // KULLANICIYI SORU SAYFASINA GERİ GÖNDERELİM return Redirect::to(URL::previous())->withErrors($validator->messages()); } else { // SORUYU VERİTABANINA EKLEYELİM $comment = new Comments(); $comment->user_id = Auth::user()->id; $comment->question_id = $postData['question_id']; $comment->comment = e(trim($postData['comment'])); $comment->created_at = date('Y-m-d H:i:s'); $comment->created_ip = Request::getClientIp(); $comment->save(); // KULLANICIYI YENİDEN SORUYA YÖNLENDİRELİM return Redirect::to(URL::previous()); } }
public function login() { //Reglas $rules = array('iCorreo' => 'required|regex:/^([a-zA-Z0-9])+@espoch.edu.ec/', 'iPassword' => 'required'); //Mensajes $messages = array('required' => 'El campo :attribute es obligatorio', 'correo' => 'El campo :attribute debe ser un email institucional'); $validation = Validator::make(Input::all(), $rules, $messages); if ($validation->fails()) { return Redirect::to(URL::previous())->withInput()->withErrors($validation); } else { $credenciales = array('correo_usuario' => e(Input::get('iCorreo')), 'password' => e(Input::get('iPassword'))); if (Auth::attempt($credenciales)) { $id = Auth::User()->id; $user = User::find($id); $user->estado_usuario = 1; $user->save(); switch (Auth::User()->tipo_usuario) { case 1: return Redirect::to('/administrador/index'); break; case 2: return Redirect::to('/moderador/index'); break; case 3: return Redirect::to('/usuarios/index'); break; } } else { return Redirect::to(URL::previous())->with('mensaje', 'Credenciales Inválidas'); } } }
public function login(Request $request) { // your SIGN IN WITH TWITTER button should point to this route $sign_in_twitter = true; $force_login = false; $twitter_intended = Session::get('url.intended'); $URL_previous = \URL::previous(); $path_previous = str_replace('/', '', parse_url(\URL::previous())['path']); $auth_entrance = config('authenticate.entrance'); if ($path_previous != $auth_entrance) { $twitter_intended = $URL_previous; } Session::put('twitter_intended', $twitter_intended); // Skip login with Twitter if user already logged in another page if (Session::get('twitter_handle')) { return Redirect::back(); } // Make sure we make this request w/o tokens, overwrite the default values in case of login. Twitter::reconfig(['token' => '', 'secret' => '']); $token = Twitter::getRequestToken(route('twitter.callback')); if (isset($token['oauth_token_secret'])) { $url = Twitter::getAuthorizeURL($token, $sign_in_twitter, $force_login); Session::put('oauth_state', 'start'); Session::put('oauth_request_token', $token['oauth_token']); Session::put('oauth_request_token_secret', $token['oauth_token_secret']); return Redirect::to($url); } return Redirect::route('twitter.error'); }
public function getError($exception, $code) { // for local testing and getting error emails just make not sign remove, i.e: if(Config::get('app.debug')) if (!Config::get('app.debug')) { // From where user is coming $previous_url = URL::previous(); //The above one is for Laravel, you can use this also in PHP projects $previous_url = $_SERVER['HTTP_REFERER']; //User IP address $ip = Request::getClientIp(); //The above one is for Laravel, you can use this also in PHP projects $ip = $_SERVER['REMOTE_ADDR']; // Get requested URL, Date and Time. $url = Request::url(); $now = new DateTime(); $errorDate = date_format($now, 'l, d-M-Y => H:i:s T'); // Getting browser Info from models/Error404 class. $browserInfo = Error404::getBrowser(); $browserName = $browserInfo['name']; $browserVersion = $browserInfo['version']; $platform = $browserInfo['platform']; // Getting Location Info passing the ip address to the function in models/Error404 class. $ipInfo = Error404::getIp($ip); $country = $ipInfo['country']; $state = $ipInfo['state']; $town = $ipInfo['town']; //generate more Info in mail-subject, for example for multiple web sites you can change MY Web to the name of your web $subject = 'My Web Error : '; // Log the info if you want to... Log::info("###### My Web ERROR ######"); Log::info("IP: {$ip}"); Log::info("URL: {$url}"); Log::info("Date and Time: {$errorDate}"); Log::info("Browser Name/Version: {$browserName} / {$browserVersion}"); Log::info("Visitor's Country, State and City: {$country}, {$state}, {$town}"); Log::info("Visitor coming from: {$previous_url}"); Log::info("###### !ERROR ######\n"); //Creating the final message to send via E-mail to web-admin $message = "###### ERROR ###### <br/>\n Error Code: <b>{$code}</b> <br/>\n IP: {$ip} <br/>\n URL: {$url} <br/>\n Date and Time: {$errorDate} <br/>\n Browser Name/Version: {$browserName} / {$browserVersion} <br/>\n Operating System: {$platform} <br/>\n Visitor's Country, State and City: {$country}, {$state}, {$town} .<br/>\n Visitor coming from: {$previous_url} <br/>"; if ($code != 404) { $message .= "Exeption:<br/>{$exception}<br/>"; $subject .= " php_error : {$code}"; } else { $subject .= ' Route missing'; } $message .= "###### !ERROR ######"; // Sending Error Report via E-mail -> Please edit this and enter your email receiving and sending e-mail address try { Mail::send('emails.error_email', array('var' => $message), function ($message) use($subject) { $message->to('*****@*****.**')->from('*****@*****.**')->subject("{$subject}"); }); } catch (Exception $e) { Log::info("{$e}\n"); } $headline = "OOPS! YOU DON'T WANT TO BE HERE"; // $headline is the line you want to display on the page. // Finally after reciving error email and loging the information show the HTML page to user you created for end-user. return View::make('view/error')->withCode($code)->withHeadline($headline); } //Closing of if(app.debug) }
public function modder($dash, $id, $mode) { if (Request::getMethod() == 'GET') { switch ($mode) { case 'delete': $validator = Validator::make(['id' => $id], ['id' => 'required|exists:subjects,id']); if ($validator->fails()) { return Redirect::to(URL::previous()); } self::delete($id); return Redirect::to(URL::previous()); case 'update': $validator = Validator::make(['id' => $id], ['id' => 'required|exists:subjects,id']); if ($validator->fails()) { return Redirect::to(URL::previous()); } $theme = Theme::uses('dashboard')->layout('default'); $view = ['id' => $id]; $theme->setTitle(Setting::get('system.adminsitename') . ' Subjects'); $theme->breadcrumb()->add([['label' => 'Dashboard', 'url' => Setting::get('system.dashurl')], ['label' => 'Subjects', 'url' => Setting::get('system.dashurl') . '/subjects'], ['label' => $id, 'url' => Setting::get('system.dashurl') . '/subject/edit/' . $id . '/update']]); return $theme->scope('subject.update', $view)->render(); case 'view': $validator = Validator::make(['id' => $id], ['id' => 'required|exists:subjects,id']); if ($validator->fails()) { return Redirect::to(URL::previous()); } $theme = Theme::uses('dashboard')->layout('default'); $view = ['id' => $id]; $theme->setTitle(Setting::get('system.adminsitename') . ' Subjects'); $theme->breadcrumb()->add([['label' => 'Dashboard', 'url' => Setting::get('system.dashurl')], ['label' => 'Subjects', 'url' => Setting::get('system.dashurl') . '/subjects'], ['label' => $id, 'url' => Setting::get('system.dashurl') . '/subject/edit/' . $id . '/update']]); return $theme->scope('subject.view', $view)->render(); case 'create': $theme = Theme::uses('dashboard')->layout('default'); $view = ['id' => 0]; $theme->setTitle(Setting::get('system.adminsitename') . ' Subjects'); $theme->breadcrumb()->add([['label' => 'Dashboard', 'url' => Setting::get('system.dashurl')], ['label' => 'Subjects', 'url' => Setting::get('system.dashurl') . '/subjects'], ['label' => $id, 'url' => Setting::get('system.dashurl') . '/subject/edit/0/update']]); return $theme->scope('subject.create', $view)->render(); default: return "UNAUTHORISED METHOD"; break; } } if (Request::getMethod() == 'POST') { switch ($mode) { case 'update': self::update($id); return Redirect::to('/subjects'); case 'create': if ($id == 0) { self::create(); return Redirect::to('/subjects'); } return Redirect::to(URL::previous()); default: Log::error('UnAuthorised Access at Subjects Page.'); return Redirect::to('dash'); } } }
/** * Authenticate with github */ public function login() { if (!Session::has('url.intended')) { Session::put('url.intended', URL::previous()); } // redirect to the github authentication url return view::make('users.login'); }
public function __construct() { $this->beforeFilter(function () { if (Auth::user()->role_id != "3") { return Redirect::to(URL::previous()); } }); }
public function delete($id) { $this->communityRepostory->delete($id); $ref = \Input::get('ref', false); if ($ref) { return \Redirect::to(\URL::previous()); } return \Redirect::route('communities'); }
/** * Log user out. * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function logout() { // Save user id to use later $userId = $this->auth->user()->id; // Log user out and fire event $this->auth->logout(); event(new UserLoggedOut($userId)); return redirect(\URL::previous()); }
public function doAdd($user_id) { if (!me()->hasPermissionTo('add', 'Recommendation')) { err('You don\'t have permission to leave a recommendation for that user.'); return Redirect::to(URL::previous()); } $recommendation = new Recommendation(); return $recommendation->validateAndUpdateFromArray(Input::all()); }
public function unLikeGuide($id) { $guideLike = GuideLike::where('user_id', Auth::user()->id)->where('guide_id', $id)->first(); if ($guideLike != null) { $guide = Guide::findOrFail($id); $guideLike->delete(); $guide->updateLikes(); } return redirect(URL::previous()); }
public function statusResponse($message, $status = 200, $withInput = true) { $backurl = isset($message['backurl']) ? $message['backurl'] : URL::previous(); $wantsJson = $this->wantsJson; // isset($message['wantsjson'])? $message['wantsjson'] : Request::wantsJson(); unset($message['wantsjson']); unset($message['backurl']); $message['status'] = $status; return $wantsJson ? Response::json($message, $status) : ($withInput ? Redirect::to($backurl)->with($message)->withInput() : Redirect::to($backurl)->with($message)); }
public function edit() { $slug = \Input::get('slug'); $page = $this->additionalPageRepository->get($slug); if (empty($page)) { return \Redirect::to(\URL::previous()); } if ($val = \Input::get('val')) { $this->additionalPageRepository->save($slug, $val); } return $this->theme->view('additional-page.edit', ['page' => $this->additionalPageRepository->get($slug)])->render(); }