本文整理汇总了PHP中Illuminate\Http\Request::old方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::old方法的具体用法?PHP Request::old怎么用?PHP Request::old使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Http\Request
的用法示例。
在下文中一共展示了Request::old方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getIndex
/**
* Responds to requests to GET /generator/lorem_ipsum
*/
public function getIndex(Request $request)
{
$lorem_ipsum = [];
$count = $request->old('count') && $request->old('count') > 0 ? $request->old('count') : 5;
$type = $request->old('type') ? $request->old('type') : 'paragraphs';
return view('generators.lorem_ipsum', ['lorem_ipsum' => $lorem_ipsum, 'count' => $count, 'type' => $type]);
}
示例2: create
/**
* Show user form.
*
* @return \Illuminate\View\View
*/
public function create()
{
$roles = $this->getAllowedRoles();
$selectedRoles = $this->request->old('roles');
$user = new User(['blocked' => 0, 'confirmed' => 1]);
return view('administrator.users.create', compact('user', 'roles', 'selectedRoles'));
}
示例3: create
/**
* Show role form.
*
* @return \Illuminate\View\View
*/
public function create()
{
$role = new Role();
$permissions = Permission::all();
$selectedPermissions = $this->request->old('permissions', []);
return view('administrator.roles.create', compact('role', 'permissions', 'selectedPermissions'));
}
示例4: getRequestAsArray
public function getRequestAsArray($method)
{
if ($old = $this->request->old()) {
return $old;
}
return $this->request->all();
}
示例5: getLogin
public function getLogin(Request $request)
{
if ($request->old('email') && $request->old('nome')) {
return view('login.index', ['email' => $request->old('email'), 'nome' => $request->old('nome')]);
}
return redirect()->back();
}
示例6: getIndex
/**
* Responds to requests to GET /generator/random_user
*/
public function getIndex(Request $request)
{
$users = [];
$count = $request->old('count') && $request->old('count') > 0 ? $request->old('count') : 5;
$options = $request->old('options') ? $request->old('options') : [];
//address,phone,email,etc
return view('generators.random_user', ['count' => $count, 'users' => $users, 'options' => $options]);
}
示例7: getRequestAsArray
public function getRequestAsArray($method)
{
if ($old = $this->request->old()) {
$data = $old;
} else {
$data = $this->request->all();
}
return $data;
}
示例8: getOldValue
/**
* @param string $name
* @return null|string
*/
public function getOldValue($name)
{
$name = str_replace(['[', ']'], ['.', ''], $name);
$current = $this->request->input($name);
$old = $this->request->old($name);
if (isset($current)) {
return $current;
}
if (isset($old)) {
return $old;
}
return null;
}
示例9: handle
/**
* Execute the job.
*
* @param \Illuminate\Http\Request $request
* @return string|null
*/
public function handle(Request $request)
{
$key = $this->account->generateRecoveryKey();
$registration = app('account.registration');
$registration->account_id = $this->account->id();
$registration->firstname = $request->old('firstname');
$registration->surname = $request->old('surname');
$registration->country = $request->old('country');
$registration->gender = $request->old('gender');
$registration->birthday = $this->birthday($request);
$registration->save();
event(new Created($this->account));
return $key;
}
示例10: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param Request $request
* @return View
*/
public function edit($id, Request $request)
{
/** @var Training $training */
$training = Training::findOrFail($id);
$training->fill($request->old());
return $this->render('training/edit', ['training' => $training]);
}
示例11: create
/**
* The create form.
* @param \Illuminate\Http\Request $request
* @return Response
*/
public function create(Request $request)
{
$options = $request->old('option');
if (!is_array($options)) {
$options = [1 => '', 2 => '', 3 => ''];
}
return View::make('polls.create')->with('options', $options);
}
示例12: handle
/**
* Handle the event.
*/
public function handle(Request $request)
{
/* @var FieldType $field */
foreach ($request->old() as $key => $value) {
if ($field = $this->builder->getFormField($key)) {
$field->setValue($value);
}
}
}
示例13: edit
public function edit(Request $r, $id)
{
$user = User::findOrFail($id);
$errors = [];
if ($r->session()->has('errors')) {
$errors = $r->session()->get('errors')->all();
}
return view('admin.users.edit')->with('user', $user->fill($r->old()))->with('errors', $errors)->with('method', 'put');
}
示例14: create
public function create(Request $request)
{
if (Gate::denies('pembelian.create')) {
return view(config('app.template') . '.error.403');
}
if (!$request->old()) {
$request->session()->forget('data_pembelian');
}
return view(config('app.template') . '.pembelian.create');
}
示例15: create
public function create(Request $request)
{
if (Gate::denies('adjustment.create')) {
return view(config('app.template') . '.error.403');
}
if (!$request->old()) {
$request->session()->forget('data_adjustment');
}
$data = ['types' => Adjustment::$types, 'states' => Adjustment::$states];
return view(config('app.template') . '.adjustment.create', $data);
}