本文整理汇总了PHP中Redirect::refresh方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::refresh方法的具体用法?PHP Redirect::refresh怎么用?PHP Redirect::refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redirect
的用法示例。
在下文中一共展示了Redirect::refresh方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Save a new status
*
* @return Response
*/
public function store()
{
$this->publishStatusForm->validate(Input::only('body'));
$this->execute(new PublishStatusCommand(Input::get('body'), Auth::user()->id));
Flash::message('Your status has been updated!');
return Redirect::refresh();
}
示例2: login
/**
* Process login, only for POST http method
*
* @return \Illuminate\Http\RedirectResponse
*/
public function login()
{
/**
* Get input values
*/
$credentials = array('username' => Input::get('username'), 'password' => Input::get('password'));
/**
* Get remember me checkbox value ('on' or null)
*/
$rememberme = Input::get('rememberme', false);
/**
* Check username or password is not empty
*/
if ($credentials['username'] == '' or $credentials['password'] == '') {
return Redirect::route('login')->withInput(Input::except('password'))->with('error', 'Username or password cannot be blank');
}
/**
* Attempt to authenticate
*/
if (Auth::attempt($credentials, $rememberme)) {
/**
* Get session variable 'redirect' for previous page
*/
if ($url = Session::get('redirect', false)) {
Session::forget('redirect');
return Redirect::to($url);
}
return Redirect::refresh();
}
/**
* If authentication failed, redirect to login page
*/
return Redirect::route('login')->withInput(Input::except('password'))->with('error', 'Wrong username or password');
}
示例3: validate
/**
* Shortcut for request data validation.
*
* Ex:
* <code>
* $err = Util::validate(...);
* if ($err) return $err;
* </code>
*
* @param array $rules
* @param array $messages
* @param array $customAttributes
*
* @return bool|\Illuminate\Http\RedirectResponse
*/
public static function validate(array $rules, array $messages = array(), array $customAttributes = array())
{
$validator = Validator::make(Input::all(), $rules, $messages, $customAttributes);
if ($validator->fails()) {
self::flash(Lang::get('app.formValidationFailed'));
return Redirect::refresh()->withErrors($validator)->withInput();
}
return false;
}
示例4: create
/**
* creates a new post
* logs you in as anonymous if you are logged out
* redirects to new post on success or back on error
*
* @param string $section_title
* @return Illuminate\Http\RedirectResponse
*/
public function create($section_title)
{
$anon = $this->anon->make(Input::get('captcha'));
if (!$anon->success) {
return Redirect::refresh()->withErrors($anon->errorMessage())->withInput();
}
$post = $this->post->make(Input::get('section', ''), Input::get('data', ''), Input::get('title', ''), Input::get('url', ''), Input::get('nsfw-tag', 0), Input::get('nsfl-tag', 0), $this->section);
if ($post->success) {
$location = sprintf("/s/%s/posts/%s/%s", $post->data->section_title, $post->data->item_id, $post->data->item_title);
return Redirect::to($location);
} else {
return Redirect::back()->withErrors($post->errorMessage())->withInput();
}
}
示例5: postInscription
/**
* Traitement du formulaire d'inscription
*
* @return Redirect
*/
public function postInscription()
{
$v = User::validate(Input::all());
if ($v->passes()) {
$user = new User();
$user->username = Input::get('username');
$user->email = Input::get('email');
$user->password = Hash::make(Input::get('password'));
$user->confirmation_code = str_random(30);
$data = array('confirmation_code' => $user->confirmation_code);
Mail::send('mail.layout', $data, function ($message) {
$message->to(Input::get('email'), Input::get('username'))->subject('Echyzen : Verify your email address');
});
$user->save();
return Redirect::back()->with('flash_notice', 'Votre compte a été créé.');
}
return Redirect::refresh()->withErrors($v)->withInput();
}
示例6: moder
public function moder($id)
{
/**
* @var $obj Vacancy
*/
$obj = Vacancy::findOrFail($id);
if (!empty($_POST)) {
$data = Input::only(array('active', 'email', 'title', 'text'));
$validation = $obj->validate($data);
if ($validation->fails()) {
return Redirect::refresh()->with('message', array('text' => $validation->errors()->first()))->withInput($data);
} else {
$obj->fill($data);
$obj->save();
return Redirect::refresh()->with('message', array('text' => 'Вакансия успешно сохранена'));
}
}
return View::make('vacancies.moder', array('item' => $obj));
}
示例7: function
<?php
Route::get('buy', function () {
return View::make('buy');
});
Route::post('buy', function () {
$billing = App::make('Acme\\Billing\\BillingInterface');
try {
$customerId = $billing->charge(['email' => Input::get('email'), 'token' => Input::get('stripe-token')]);
$user = User::first();
$user->billing_id = $customerId;
$user->save();
} catch (Exception $e) {
return Redirect::refresh()->withFlashMessage($e->getMessage());
}
return 'Charge was successful';
});