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


PHP Requests\Request类代码示例

本文整理汇总了PHP中App\Http\Requests\Request的典型用法代码示例。如果您正苦于以下问题:PHP Request类的具体用法?PHP Request怎么用?PHP Request使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Request类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: 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

示例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: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Validator $validator, Request $request)
 {
     $messages = $validator->errors();
     $request->session()->flash('status', 'Task was successful!');
     foreach ($messages->all() as $message) {
         print_r($message);
     }
     exit;
 }
开发者ID:system3d,项目名称:consultas-tecnicas,代码行数:14,代码来源:UserController.php

示例5: mailOrder

 public function mailOrder(Request $request)
 {
     $view = 'emails.order';
     $subject = 'New Order Receipt';
     $data = $request->only('product_name', 'message_text', 'email', 'phone');
     $data['title'] = "New Order Email";
     $user = (object) ['email' => 'info@dakrush-ent.com'];
     return $this->sendTo($user, $subject, $view, $data);
 }
开发者ID:shegun-babs,项目名称:dakrush,代码行数:9,代码来源:OrderMailer.php

示例6: storeOrUpdate

 public function storeOrUpdate(Request $request, $id = null)
 {
     $user = $id ? $this->getById($id) : new User();
     $user->name = $request->input('name');
     $user->email = $request->input('email');
     $user->password = Hash::make($request->input('password'));
     $user->status = UserStatus::ACTIVATED();
     $user->save();
     return $user;
 }
开发者ID:jaytyrrell13,项目名称:jaytyrrell.co,代码行数:10,代码来源:EloquentUsersRepository.php

示例7: storeOrUpdate

 /**
  * If a post exists, update its properties. If not then create new
  * 
  * @param  Request $request 
  * @param  string  $id
  * @return \Illuminate\Database\Eloquent\Model
  */
 public function storeOrUpdate(Request $request, $id = null)
 {
     $post = $id ? $this->getById($id) : new Post();
     $post->user_id = Auth::id();
     $post->title = $request->input('title');
     $post->body = $request->input('body');
     $post->excerpt = $request->input('excerpt');
     $post->uri = str_slug($request->input('title'));
     $post->status = PostStatus::PUBLISHED();
     $post->save();
     return $post;
 }
开发者ID:jaytyrrell13,项目名称:jaytyrrell.co,代码行数:19,代码来源:EloquentPostsRepository.php

示例8: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int                                $organizationId
  * @param CreateOrgReportingOrgRequestManager $createOrgReportingOrgRequestManager
  * @param Request                             $request
  * @return Response
  */
 public function update($organizationId, CreateOrgReportingOrgRequestManager $createOrgReportingOrgRequestManager, Request $request)
 {
     $organization = $this->organizationManager->getOrganization($organizationId);
     if (Gate::denies('belongsToOrganization', $organization)) {
         return redirect()->route('activity.index')->withResponse($this->getNoPrivilegesMessage());
     }
     $this->authorize('edit_activity', $organization);
     $input = $request->all();
     $this->orgReportingOrgManager->update($input, $organization);
     $this->organizationManager->resetStatus($organizationId);
     $response = ['type' => 'success', 'code' => ['updated', ['name' => 'Reporting Organization']]];
     return redirect()->route("organization.show", $organizationId)->withResponse($response);
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:21,代码来源:OrgReportingOrgController.php

示例9: loadRequest

 public function loadRequest(Request $request)
 {
     $class = get_called_class();
     $class = explode('\\', $class);
     $class = end($class);
     $prefix = $class . '_';
     $arr_res = $request->all();
     foreach ($arr_res as $key => $value) {
         if (preg_match("/{$prefix}(?<name>.*)/", $key, $match)) {
             $name = $match['name'];
             $this->{$name} = $value;
         }
     }
 }
开发者ID:trongtri0705,项目名称:staff,代码行数:14,代码来源:ActiveModel.php

示例10: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     if (Request::has('data')) {
         return ['data' => 'required'];
     }
     return ['judul_berita' => 'required', 'kategori_berita' => 'required', 'isi' => 'required', 'foto' => 'required'];
 }
开发者ID:brutalcrozt,项目名称:SI-Sekolah-L5,代码行数:12,代码来源:BeritaRequest.php

示例11: update

 /**
  * updates activity title
  * @param                     $id
  * @param Request             $request
  * @param TitleRequestManager $titleRequestManager
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update($id, Request $request, TitleRequestManager $titleRequestManager)
 {
     if (!$this->currentUserIsAuthorizedForActivity($id)) {
         return redirect()->back()->withResponse($this->getNoPrivilegesMessage());
     }
     $activityData = $this->titleManager->getActivityData($id);
     $this->authorizeByRequestType($activityData, 'title');
     $activityTitle = $request->all();
     if ($this->titleManager->update($activityTitle, $activityData)) {
         $this->activityManager->resetActivityWorkflow($id);
         $response = ['type' => 'success', 'code' => ['updated', ['name' => 'Activity Title']]];
         return redirect()->to(sprintf('/activity/%s', $id))->withResponse($response);
     }
     $response = ['type' => 'danger', 'code' => ['update_failed', ['name' => 'Activity Title']]];
     return redirect()->back()->withInput()->withResponse($response);
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:23,代码来源:TitleController.php

示例12: getPaginatedEntries

 /**
  * Returns the entries for the current page for this view.
  *
  * @return \Illuminate\Pagination\LengthAwarePaginator paginator containing the entries for the page, sorted/ordered or not.
  */
 public function getPaginatedEntries()
 {
     // Gets all the entries, sensitive to whether we're sorting for this request.
     $allEntries = $this->getEntriesSortable();
     $page = Paginator::resolveCurrentPage('page');
     // Returns the number of entries perpage, defined by Model#getPerPage
     $perPage = $allEntries->first()->getPerPage();
     // If the page number is beyond the number of pages, get it back to the last page.
     while (($page - 1) * $perPage > count($allEntries)) {
         $page -= 1;
     }
     // Return the subset of the entries for this page
     $entriesForPage = $allEntries->splice(($page - 1) * $perPage, $perPage);
     // Return the paginator for this subset.
     $entriesPaginator = new LengthAwarePaginator($entriesForPage, $this->getEntries()->first()->toBase()->getCountForPagination(), $perPage, $page, ['path' => Paginator::resolveCurrentPath(), 'pageName' => 'page']);
     // If we're ordering, append that to the links
     if ($this->getSortOrder()) {
         $entriesPaginator->appends(['order' => Request::get('order')]);
     }
     // If we're sorting, append that to the links
     if ($this->isSorting()) {
         $entriesPaginator->appends(['sort' => $this->getSortKey()]);
     }
     return $entriesPaginator;
 }
开发者ID:uidaho,项目名称:squireproject,代码行数:30,代码来源:PaginatedRequest.php

示例13: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     if (Request::segment(3) == 'create') {
         $this->rules['file_name'] .= '|required';
     }
     return $this->rules;
 }
开发者ID:alexmon1989,项目名称:kadsgroup,代码行数:12,代码来源:StoreCertificatesRequest.php

示例14: update

 /**
  * @param                      $id
  * @param Request              $request
  * @param BudgetRequestManager $budgetRequestManager
  * @return mixed
  */
 public function update($id, Request $request, BudgetRequestManager $budgetRequestManager)
 {
     $activityData = $this->activityManager->getActivityData($id);
     if (Gate::denies('ownership', $activityData)) {
         return redirect()->back()->withResponse($this->getNoPrivilegesMessage());
     }
     $this->authorizeByRequestType($activityData, 'budget');
     $budget = $request->all();
     if ($this->budgetManager->update($budget, $activityData)) {
         $this->activityManager->resetActivityWorkflow($id);
         $response = ['type' => 'success', 'code' => ['updated', ['name' => 'Budget']]];
         return redirect()->to(sprintf('/activity/%s', $id))->withResponse($response);
     }
     $response = ['type' => 'danger', 'code' => ['update_failed', ['name' => 'Budget']]];
     return redirect()->back()->withInput()->withResponse($response);
 }
开发者ID:younginnovations,项目名称:aidstream,代码行数:22,代码来源:BudgetController.php

示例15: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $tipo_documento_valor = Request::get('per_dcmto_tipo');
     $doc_numero = 'required';
     $per_dcmto_tipo = 'required';
     $per_ruc = 'sometimes';
     if (Request::get('per_tipo') == '0002') {
         $per_ruc = 'required';
     }
     if ($tipo_documento_valor == '0001') {
         $doc_numero = 'required|numeric|digits:8|unique:persona,per_dcmto_numero';
     } else {
         if ($tipo_documento_valor == '0002') {
             $doc_numero = 'required|max:12';
         } else {
             if ($tipo_documento_valor == '0003') {
                 $doc_numero = 'required|numeric|digits:11';
             } else {
                 if ($tipo_documento_valor == '0006' || $tipo_documento_valor == '0004' || $tipo_documento_valor == '0005') {
                     $doc_numero = 'required|max:12';
                 }
             }
         }
     }
     if (Request::get('per_nacion') == '0002') {
         $per_dcmto_tipo = 'required|same:0002';
     }
     return ['per_tipo' => 'required', 'per_nacion' => 'sometimes|required', 'per_dcmto_tipo' => 'sometimes|' . $per_dcmto_tipo, 'per_dcmto_numero' => 'sometimes|' . $doc_numero, 'per_ape_paterno' => 'sometimes|required', 'per_ape_materno' => 'sometimes|required', 'per_nombre1' => 'sometimes|required', 'per_nombre2' => 'sometimes|sometimes', 'per_razon_social' => 'sometimes|required', 'per_ruc' => $per_ruc, 'per_direccion' => 'required', 'per_ubg_id' => 'required|numeric', 'per_direc_referencia' => 'required'];
 }
开发者ID:OscarSith,项目名称:notaria-web,代码行数:34,代码来源:PersonaRequest.php


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