當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Request::all方法代碼示例

本文整理匯總了PHP中App\Http\Requests\Request::all方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::all方法的具體用法?PHP Request::all怎麽用?PHP Request::all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在App\Http\Requests\Request的用法示例。


在下文中一共展示了Request::all方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: update

 /**
  * updates activity sector
  * @param                      $id
  * @param Request              $request
  * @param SectorRequestManager $sectorRequestManager
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update($id, Request $request, SectorRequestManager $sectorRequestManager)
 {
     $activityData = $this->activityManager->getActivityData($id);
     if (Gate::denies('ownership', $activityData)) {
         return redirect()->back()->withResponse($this->getNoPrivilegesMessage());
     }
     $this->authorizeByRequestType($activityData, 'sector');
     $sectors = $request->all();
     foreach ($sectors['sector'] as &$sector) {
         if ($sector['sector_vocabulary'] == 1 || $sector['sector_vocabulary'] == '') {
             $sector['sector_vocabulary'] = 1;
             $sector['sector_category_code'] = '';
             $sector['sector_text'] = '';
         } elseif ($sector['sector_vocabulary'] == 2) {
             $sector['sector_code'] = '';
             $sector['sector_text'] = '';
         } else {
             $sector['sector_code'] = '';
             $sector['sector_category_code'] = '';
         }
     }
     if ($this->sectorManager->update($sectors, $activityData)) {
         $this->activityManager->resetActivityWorkflow($id);
         $response = ['type' => 'success', 'code' => ['updated', ['name' => 'Sector']]];
         return redirect()->to(sprintf('/activity/%s', $id))->withResponse($response);
     }
     $response = ['type' => 'danger', 'code' => ['update_failed', ['name' => 'Sector']]];
     return redirect()->back()->withInput()->withResponse($response);
 }
開發者ID:younginnovations,項目名稱:aidstream,代碼行數:36,代碼來源:SectorController.php

示例2: update

 /**
  * Just passes everything into the update. If there's a stricter
  * requirement,
  *
  * @param Request $request
  * @param $id
  * @return mixed
  */
 public function update(Request $request, $id)
 {
     if ($this->repository->find($id)) {
         return $this->repository->update($id, $request->all());
     }
     return null;
 }
開發者ID:keithyw,項目名稱:jackhammer,代碼行數:15,代碼來源:CoreCrud.php

示例3: updatePost

 /**
  * Update post
  * @param  Request $request 
  * @param  int  $id      
  * @return void
  */
 public function updatePost(Request $request, $id)
 {
     DB::beginTransaction();
     try {
         $post = Post::findOrFail($id);
         $oldImage = "";
         $inputs = $request->all();
         if ($request->hasFile('images')) {
             $oldImage = public_path() . config('model.posts.path_folder_photo_post') . $post->images;
             $imageFile = $request->file('images');
             $inputs['images'] = $this->__storeImagePost($imageFile);
         } else {
             unset($inputs['images']);
         }
         if ($inputs['type'] == 2) {
             $this->__changeStickyPost($id);
         }
         $post->fill($inputs);
         $post->save();
         if (strlen($oldImage) != 0) {
             if (File::exists($oldImage)) {
                 File::delete($oldImage);
             }
         }
     } catch (Exception $e) {
         DB::rollback();
         throw new Exception("Error Processing Request", 1);
     }
     DB::commit();
 }
開發者ID:doankhoi,項目名稱:Application,代碼行數:36,代碼來源:PostRepository.php

示例4: messages

 public function messages()
 {
     $input = parent::all();
     $messages = ['doacoes.required' => 'Doação precisa ser informada', 'doacoes.array' => 'Doação precisa ser um conjunto'];
     /*
      * Verifica se foram passados endereços
      * Caso contrário devolver as regras
      */
     if (!isset($input['doacoes']) || !is_array($input['doacoes'])) {
         return $messages;
     }
     /*
      * Messages para validação dos doacoes(endereços)
      * @var array
      */
     $doacoesMessages = ['value.required' => 'Você precisa informar um valor', 'value.numeric' => 'O valor precisa ser numérico', 'value.min' => 'Valor mínimo :min'];
     $doacoes = $input['doacoes'];
     $newMessagens = [];
     foreach ($doacoes as $row => $address) {
         foreach ($doacoesMessages as $key => $value) {
             $newMessagens['doacoes.' . $row . '.' . $key] = $row + 1 . ': ' . $value;
         }
     }
     return array_merge($messages, $newMessagens);
 }
開發者ID:emtudo,項目名稱:laravel-paypal,代碼行數:25,代碼來源:DonativoStoreRequest.php

示例5: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $input = Request::all();
     if ($input['or_number'] != 'Cash' && $input['or_number'] != 'CASH' && $input['or_number'] != 'cash') {
         return ['si_no' => 'numeric|unique:sales_invoices', 'dr_number' => 'numeric|unique:sales_invoices', 'or_number' => 'numeric'];
     }
     return ['si_no' => 'numeric|unique:sales_invoices', 'dr_number' => 'numeric|unique:sales_invoices'];
 }
開發者ID:jacqhernandez,項目名稱:hsms,代碼行數:13,代碼來源:UpdateStatusRequest.php

示例6: all

 public function all()
 {
     $attributes = parent::all();
     //remove spaces btw words in churcn name
     $name = preg_replace("/ {2,}/", " ", $attributes['name']);
     $attributes['name'] = $name;
     return $attributes;
 }
開發者ID:umahatokula,項目名稱:academia,代碼行數:8,代碼來源:createClassRequest.php

示例7: all

 /**
  * Alter some request data.
  *
  * @return array
  */
 public function all()
 {
     $data = parent::all();
     if ($data['password'] == config('admin.password_mask') || !$data['password']) {
         unset($data['password']);
     }
     return $data;
 }
開發者ID:manogi,項目名稱:gfw-qm,代碼行數:13,代碼來源:RegisterRequest.php

示例8: all

 /**
  * Alter some request data.
  *
  * @return array
  */
 public function all()
 {
     $data = parent::all();
     if (isset($data['vintage'])) {
         $data['vintage'] = intval($data['vintage']);
     }
     return $data;
 }
開發者ID:manogi,項目名稱:gfw-qm,代碼行數:13,代碼來源:CustomerSampleRequest.php

示例9: all

 public function all()
 {
     $data = collect(parent::all());
     if ($data->has('phone') && $data->get('phone') != '') {
         $data->put('phone', preg_replace('/[^0-9]/', '', $data->get('phone')));
     }
     return $data->toArray();
 }
開發者ID:pinnaclesoftware,項目名稱:Work-Tracking-System,代碼行數:8,代碼來源:UserRequest.php

示例10: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $input = Request::all();
     if (array_key_exists('save', $input)) {
         return ['your-time' => ['required', 'regex:/^([0-5][0-9]|[0-9])?:?([0-5][0-9]|[0-9]):([0-5][0-9]|[0-9])(\\.\\d{1,2})?$/'], 'winners-time' => ['required', 'regex:/^([0-5][0-9]|[0-9])?:?([0-5][0-9]|[0-9]):([0-5][0-9]|[0-9])(\\.\\d{1,2})?$/', 'compare_time:your-time'], 'last-0' => 'required', 'first-0' => 'required', 'last-1' => 'required', 'first-1' => 'required', 'last-2' => 'required', 'first-2' => 'required', 'last-3' => 'required', 'first-3' => 'required', 'last-4' => 'required', 'first-4' => 'required', 'race-name' => 'required', 'distance-km' => ['required', 'numeric'], 'race-location' => 'required', 'hidden-lat' => 'required', 'hidden-long' => 'required', 'gender' => 'required', 'technique' => 'required'];
     } else {
         return ['your-time' => ['required', 'regex:/^([0-5][0-9]|[0-9])?:?([0-5][0-9]|[0-9]):([0-5][0-9]|[0-9])(\\.\\d{1,2})?$/'], 'winners-time' => ['required', 'regex:/^([0-5][0-9]|[0-9])?:?([0-5][0-9]|[0-9]):([0-5][0-9]|[0-9])(\\.\\d{1,2})?$/', 'compare_time:your-time'], 'last-0' => 'required', 'first-0' => 'required', 'last-1' => 'required', 'first-1' => 'required', 'last-2' => 'required', 'first-2' => 'required', 'last-3' => 'required', 'first-3' => 'required', 'last-4' => 'required', 'first-4' => 'required'];
     }
 }
開發者ID:phegman,項目名稱:XC-Points-Calc,代碼行數:14,代碼來源:CreateRaceRequest.php

示例11: all

 public function all()
 {
     $input = parent::all();
     if (array_key_exists('lideranca', $input) && $input['lideranca'] == 'on') {
         $input['lideranca'] = true;
     } else {
         $input['lideranca'] = false;
     }
     return $input;
 }
開發者ID:marcosdefontes,項目名稱:diakonia,代碼行數:10,代碼來源:MusicaStaffRequest.php

示例12: messages

 /**
  * Mensagens personalizadas da validação.
  *
  * @return array
  */
 public function messages()
 {
     $input = (object) Request::all();
     $messages = array();
     $messages = ['grupo.unique' => 'Grupo já cadastrado.'];
     if ($input->acao != 'excluir') {
         $messages = ['ids_selecionados.required' => 'O campo Usuários selecionados é obrigatório.'];
     }
     return $messages;
 }
開發者ID:alipusman,項目名稱:laravel5,代碼行數:15,代碼來源:GrupoRequest.php

示例13: all

 public function all()
 {
     $atts = parent::all();
     if ($atts['password'] === $atts['password_confirmation']) {
         $crypted = bcrypt($atts['password']);
         $atts['password'] = $crypted;
         $atts['password_confirmation'] = $crypted;
     }
     return $atts;
 }
開發者ID:SmarchSoftware,項目名稱:watchtower,代碼行數:10,代碼來源:UserStoreRequest.php

示例14: rules

 /**
  * Regras de validação.
  *
  * @return array
  */
 public function rules()
 {
     $input = (object) Request::all();
     if ($input->acao == 'E') {
         $validar = array();
     } else {
         $validar = ['codigo' => "required|min:1|max:15|unique:tbprodutos,codigo,{$input->id}", 'descricao' => 'required|min:1|max:60', 'quantidade' => 'required|numeric', 'preco' => 'required|numeric'];
     }
     return $validar;
 }
開發者ID:Mardonisestudant,項目名稱:laravel,代碼行數:15,代碼來源:UserRequest.php

示例15: all

 /**
  * Get all form input.
  *
  * @return array
  */
 public function all()
 {
     $input = parent::all();
     foreach ($this->getBoardOptions() as $optionGroup) {
         foreach ($optionGroup->options as $option) {
             if (isset($input[$option->option_name])) {
                 $input[$option->option_name] = $option->getSanitaryInput($input[$option->option_name]);
             }
         }
     }
     return $input;
 }
開發者ID:LulzNews,項目名稱:infinity-next,代碼行數:17,代碼來源:BoardConfigRequest.php


注:本文中的App\Http\Requests\Request::all方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。