本文整理汇总了PHP中Input::old方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::old方法的具体用法?PHP Input::old怎么用?PHP Input::old使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Input
的用法示例。
在下文中一共展示了Input::old方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCreate
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function getCreate()
{
$permissions = $this->permission->all();
$selectedPermissions = Input::old('permissions', array());
$title = Lang::get('admin/roles/title.create_a_new_role');
return View::make('admin/roles/create', compact('permissions', 'selectedPermissions', 'title'));
}
示例2: update
public function update($view, $account)
{
$view->form(function ($view) use($account) {
$view->page_header(function ($view) {
$view->title('EDIT ACCOUNT');
});
// The response body is the Account
$account = $account->get();
// Get Roles and put it in a nice array for the dropdown
$roles = array('' => '') + model_array_pluck(API::get(array('roles'))->get('results'), function ($role) {
return $role->lang->name;
}, 'id');
// Get the Roles that belong to a User and put it in a nice array for the dropdown
$active_roles = array();
if (isset($account->roles)) {
$active_roles = model_array_pluck($account->roles, 'id', '');
}
// Get Languages and put it in a nice array for the dropdown
$languages = model_array_pluck(API::get(array('languages'))->get('results'), function ($language) {
return $language->name;
}, 'id');
$view->text('name', __('admin::account.update.form.name'), Input::old('name', $account->name));
$view->text('email', __('admin::account.update.form.email'), Input::old('email', $account->email));
$view->password('password', __('admin::account.update.form.password'));
$view->multiple('roles[]', __('admin::account.update.form.roles'), $roles, Input::old('roles', $active_roles));
$view->dropdown('language_id', __('admin::account.update.form.language'), $languages, Input::old('language_id', $account->language->id));
$view->actions(function ($view) {
$view->submit(__('admin::account.update.buttons.edit'), 'primary');
});
}, 'PUT', prefix('admin') . 'account/' . $account->get('id') . '/edit');
}
示例3: resetAction
public function resetAction()
{
$token = "?token=" . Input::get("token");
$errors = new MessageBag();
if ($old = Input::old("errors")) {
$errors = $old;
}
$data = ["token" => $token, "errors" => $errors];
if (Input::server("REQUEST_METHOD") == "POST") {
$validator = Validator::make(Input::all(), ["email" => "required|email", "password" => "required|min:6", "password_confirmation" => "required|same:password", "token" => "required|exists:token,token"]);
if ($validator->passes()) {
$credentials = ["email" => Input::get("email")];
Password::reset($credentials, function ($user, $password) {
$user->password = Hash::make($password);
$user->save();
Auth::login($user);
return Redirect::route("user/profile");
});
}
$data["email"] = Input::get("email");
$data["errors"] = $validator->errors();
return Redirect::to(URL::route("user/reset") . $token)->withInput($data);
}
return View::make("user/reset", $data);
}
示例4: update
public static function update($view, $id)
{
// Get the Account
$response = API::get(array('account', $id));
// Handle response codes other than 200 OK
if (!$response->success) {
return Event::first($response->code);
}
// The response body is the Account
$account = $response->get();
// Get Roles and put it in a nice array for the dropdown
$roles = array('' => '') + model_array_pluck(API::get(array('role', 'all'))->get('results'), function ($role) {
return $role->lang->name;
}, 'id');
// Get the Roles that belong to a User and put it in a nice array for the dropdown
$active_roles = array();
if (isset($account->roles)) {
$active_roles = model_array_pluck($account->roles, 'id', '');
}
// Get Languages and put it in a nice array for the dropdown
$languages = model_array_pluck(API::get(array('language', 'all'))->get('results'), function ($language) {
return $language->name;
}, 'id');
$view->text('name', __('admin::account.update.form.name'), Input::old('name', $account->name));
$view->text('email', __('admin::account.update.form.email'), Input::old('email', $account->email));
$view->password('password', __('admin::account.update.form.password'));
$view->multiple('roles[]', __('admin::account.update.form.roles'), $roles, Input::old('roles', $active_roles));
$view->dropdown('language_id', __('admin::account.update.form.language'), $languages, Input::old('language_id', $account->language->id));
$view->actions(function ($view) {
$view->submit(__('admin::account.update.buttons.edit'), 'primary');
});
}
示例5: inputOld
public static function inputOld($string)
{
if (static::isLaravel()) {
return \Input::old($string);
}
return false;
}
示例6: getGenerateLicense
/**
* Show generate license form
*/
public function getGenerateLicense()
{
$this->_data['page_title'] = "Generate License";
$this->_data['affiliates'] = Affiliate::orderBy('name', 'ASC')->get();
$this->_data['products'] = Product::orderBy('name', 'ASC')->get();
$this->_data['plans'] = Plan::orderBy('name', 'ASC')->where('product_id', '=', Input::old('product_id'))->get();
return View::make('admin.utilities.generate-license', $this->_data)->nest('header', 'admin.common.header', $this->_data)->nest('footer', 'admin.common.footer', $this->_data);
}
示例7: __construct
public function __construct()
{
$errors = new MessageBag();
if ($old = Input::old("errors")) {
$errors = $old;
}
$this->errors = $errors;
}
示例8: form_old
function form_old($name, $default = null)
{
if (Input::old($name) != null) {
echo Input::old($name);
} else {
echo $default;
}
}
示例9: create
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
$promo = $this->promo;
if (Input::old('img') != '') {
$promo->img = Input::old('img');
}
return View::make('backend.promos.edit', compact('promo'));
}
示例10: getCreate
/**
* Group create.
*
* @return View
*/
public function getCreate()
{
// Get all the available permissions
$permissions = $this->permissions;
// Selected permissions
$selectedPermissions = Input::old('permissions', array());
// Show the page
return View::make('admin/groups/create', compact('permissions', 'selectedPermissions'));
}
示例11: findOrCreate
/**
* @param $model
* @param $id
* @return mixed
*/
function findOrCreate($model, $id)
{
$obj = $model::find($id);
$obj = $obj ?: new $model();
foreach (Input::old() as $key => $old) {
$obj->{$key} = $old ?: $obj->{$key};
}
return $obj;
}
示例12: testOldInputCanBeRetrievedFromSession
/**
* Test the Input::old method.
*
* @group laravel
*/
public function testOldInputCanBeRetrievedFromSession()
{
$this->setSession();
Session::$instance->session['data']['laravel_old_input'] = array('name' => 'Taylor');
$this->assertNull(Input::old('foo'));
$this->assertTrue(Input::had('name'));
$this->assertFalse(Input::had('foo'));
$this->assertEquals('Taylor', Input::old('name'));
}
示例13: getVolunteerMentors
public function getVolunteerMentors()
{
$city = \Input::old('volunteerMentorCity');
if ($city === null) {
$cities = $this->getVolunteerMentorCities();
$city = $cities ? reset($cities) : null;
}
return $city ? VolunteerMentorQuery::create()->getVolunteerMentorByCity($city) : [];
}
示例14: getCreate
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function getCreate()
{
$roles = $this->role->all();
$permissions = $this->permission->all();
$selectedRoles = Input::old('roles', array());
$selectedPermissions = Input::old('permissions', array());
$mode = 'create';
$title = Lang::get('admin/users/title.create_a_new_user');
return Theme::make('admin/users/create_edit', compact('roles', 'permissions', 'selectedRoles', 'selectedPermissions', 'title', 'mode'));
}
示例15: edit
public function edit($role)
{
if (in_array(Input::old('name', $role->name), \Role::$protected) && Input::old('name', $role->name) != Input::get('name') || in_array(Input::get('name'), \Role::$protected) && Input::old('name', $role->name) != Input::get('name')) {
return Api::to(array('error', Lang::get('admin/roles/messages.update.error'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->with('error', Lang::get('admin/roles/messages.update.error'));
}
$inputs = Input::except('csrf_token');
$save = $this->role->createOrUpdate($role->id, $this->permission->preparePermissionsForSave($inputs['permissions']));
$errors = $save->errors();
return count($errors->all()) == 0 ? Api::to(array('success', Lang::get('admin/roles/messages.update.success'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->with('success', Lang::get('admin/roles/messages.update.success')) : (Api::to(array('error', Lang::get('admin/roles/messages.update.error'))) ?: Redirect::to('admin/roles/' . $role->id . '/edit')->withErrors($errors));
}