当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::all方法代码示例

本文整理汇总了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!');
 }
开发者ID:Matth--,项目名称:laradmin,代码行数:22,代码来源:UsersController.php

示例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++;
             }
         }
     }
 }
开发者ID:larapress,项目名称:larapress,代码行数:33,代码来源:ImageAttachmentTrait.php

示例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');
 }
开发者ID:bjsmasth,项目名称:clientmanager,代码行数:25,代码来源:ClientController.php

示例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);
 }
开发者ID:acmadi,项目名称:laravel-api,代码行数:11,代码来源:Api.php

示例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');
 }
开发者ID:encry2024,项目名称:nsi-crm-healthcare,代码行数:11,代码来源:Record.php

示例6: update

 public function update($id, Request $request)
 {
     $article = Article::findOrFail($id);
     $article->update($request->all());
 }
开发者ID:vhinmanansala,项目名称:Learning-Laravel,代码行数:5,代码来源:ArticlesController.php


注:本文中的Symfony\Component\HttpFoundation\Request::all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。