本文整理汇总了PHP中URL::previous方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::previous方法的具体用法?PHP URL::previous怎么用?PHP URL::previous使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URL
的用法示例。
在下文中一共展示了URL::previous方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: requestLogin
/**
* 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);
}
}
}
示例2: SendEmail
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'));
}
}
}
示例3: faqSend
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());
}
}
示例4: guardarPerfil
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');
}
}
示例5: post
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');
}
}
}
示例6: actualizarMisionVision
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');
}
}
示例7: trackingReferrals
/**
* Tracking Referals.
*
*
*/
protected function trackingReferrals()
{
$past = \URL::previous();
if (!str_contains($past, url())) {
$this->trackingToFile('referrals', array($past));
}
}
示例8: contactSend
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('lol@lol.fr', 'sujet du message');
$message->to('m.bertonnier@gmail.com', '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());
}
}
}
示例9: __construct
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'];
}
示例10: changeApplicationLanguage
/**
* 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'));
}
示例11: updateChauffeur
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");
}
}
}
示例12: setBestLanguage
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;
}
示例13: clearAll
public function clearAll()
{
$this->notificationRepository->clearAll();
if (!\Request::ajax()) {
return \Redirect::to(\URL::previous());
}
}
示例14: setBest
public function setBest(Request $request, $id)
{
$comment = ActivityComment::findOrFail($id);
$comment->isbest = $request->input('value');
$comment->save();
return redirect(URL::previous());
}
示例15: dispatchRequest
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();
}
}
}