本文整理汇总了PHP中Symfony\Component\HttpFoundation\Request::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::all方法的具体用法?PHP Request::all怎么用?PHP Request::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpFoundation\Request
的用法示例。
在下文中一共展示了Request::all方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postCreate
/**
* Create a user
*
* @param Request $request
* @return \Illuminate\Http\RedirectResponse
* @throws \Illuminate\Foundation\Validation\ValidationException
*/
public function postCreate(Request $request)
{
$data = $request->all();
$validator = $this->validator($request->all());
if ($validator->fails()) {
$this->throwValidationException($request, $validator);
}
$user = User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
$role = Role::where('name', config('laradmin.register_user_role'))->first();
if ($role) {
$user->roles()->attach($role->id);
}
$this->userRepository->clearCache();
return redirect()->route('laradmin.users.index')->with('success', 'User was created!');
}
示例2: saveImageAttachments
/**
* Saves all the image attachments to the DB
*/
public function saveImageAttachments(Request $request)
{
//get array of all types('context') of attachments for this model
$this->attachmentNames = $this->getImageAttachmentNames();
//first of all create the index of all input attachments
foreach ($request->all() as $key => $input) {
$this->addToInputIndex($key);
}
//go through index and save them to database
foreach ($this->attachmentNames as $context) {
if (isset($this->inputIndex[$context])) {
$priority = 0;
foreach ($this->inputIndex[$context]['identifiers'] as $attachmentID) {
$field = $context . '_' . $attachmentID . '_';
//if no id feild, then create a new attachment
if ($request->get($field . 'id') == null) {
Attachment::create(['context' => $context, 'url' => $request->get($field . 'url'), 'alt' => $request->get($field . 'alt'), 'caption' => $request->get($field . 'caption'), 'status' => 'active', 'model' => get_class(), 'model_id' => $this->id, 'priority' => $priority]);
} else {
if ($request->get($field . 'url') == '' && $request->get($field . 'caption') == '' && $request->get($field . 'alt') == '') {
Attachment::destroy($request->get($field . 'id'));
} else {
$attachment = Attachment::find($request->get($field . 'id'));
$attachment->update(['context' => $context, 'url' => $request->get($field . 'url'), 'alt' => $request->get($field . 'alt'), 'caption' => $request->get($field . 'caption'), 'status' => 'active', 'priority' => $priority], ['id' => $request->get($field . 'id')]);
}
}
$priority++;
}
}
}
}
示例3: save
/**
* @param Request $request
* @param null $id if not null id it will update the records TODO
*/
public function save(Request $request, $id = null)
{
$validator = Validator::make($request->all(), ['name' => 'required', 'gender' => 'required', 'phone' => ['required', 'regex:/^([0-9]{3})-([0-9]{4})-([0-9]{6})$/'], 'email' => 'required|email', 'address' => 'required', 'nationality' => 'required', 'dob' => 'required', 'education' => 'required', 'preffered' => 'required']);
if ($validator->fails()) {
return redirect('clients/create')->withErrors($validator)->withInput();
}
$csvPath = resource_path('bjsmasth/client/csv/clients.csv');
$reader = Reader::open($csvPath);
$records = $reader->readAll();
$count = count($records);
$writer = CsvWriter::create($csvPath);
$input = Input::except('_token', 'submitBtn');
$data = implode('/', $input);
$writer->writeLine([$count + 1, $data]);
$writer->writeAll($records);
$writer->flush();
$writer->close();
Log::info('Client was successfully');
$request->session()->flash('flash_message', 'Client has been successful added!');
return redirect('clients/create');
}
示例4: checkAuthorizeParams
/**
* Check the authorization code request parameters
*
* @throws \OAuth2\Exception\ClientException
* @return array Authorize request parameters
*/
public function checkAuthorizeParams()
{
$input = $this->request->all();
return $this->getOAuth()->getAuthServer()->getGrantType('authorization_code')->checkAuthoriseParams($input);
}
示例5: updateChecklist
public function updateChecklist(Request $request)
{
$checklists = $request->all();
unset($checklists['_token']);
// Update each submitted checklist to 1
foreach ($checklists as $index => $value) {
$temp = explode("_", $index);
Checklist::where('id', $temp[1])->update(array('value' => $value));
}
return redirect()->back()->with('message', 'Checklist successfully updated')->with('msg_type', 'success');
}
示例6: update
public function update($id, Request $request)
{
$article = Article::findOrFail($id);
$article->update($request->all());
}