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


PHP Request::isMethod方法代码示例

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


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

示例1: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $rules = ['title' => 'required', 'desc' => 'required', 'image' => 'required|image'];
     if (Request::isMethod('patch')) {
         $rules['image'] = 'image';
     }
     return $rules;
 }
开发者ID:abisz,项目名称:GlobeTrotter,代码行数:13,代码来源:PictureRequest.php

示例2: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     if (Request::isMethod('post')) {
         return ['headline' => 'required|max:255', 'text' => 'required|max:255', 'startDate' => 'required|date'];
     }
     if (Request::isMethod('put')) {
         return ['headline' => 'required|max:255', 'text' => 'required|max:255'];
     }
 }
开发者ID:vi1004t,项目名称:pfg,代码行数:14,代码来源:CrearCultiuRequest.php

示例3: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     if (Request::isMethod('post')) {
         return ['username' => 'required|unique:mecanex_users', 'name' => 'required|min:3', 'surname' => 'required|min:3', 'gender_id' => 'required|integer|min:1|max:2', 'age_id' => 'required|integer|min:1|max:9', 'occupation_id' => 'required|integer|min:1|max:18', 'country_id' => 'required|integer|min:1|max:250', 'education_id' => 'required|integer|min:1|max:5'];
     }
     if (Request::isMethod('put')) {
         return ['name' => 'min:3', 'surname' => 'min:3', 'gender_id' => 'integer|min:1|max:2', 'age_id' => 'integer|min:1|max:9', 'occupation_id' => 'integer|min:1|max:18', 'country_id' => 'integer|min:1|max:250', 'education_id' => 'integer|min:1|max:5'];
     }
 }
开发者ID:skafetzo,项目名称:SPtool,代码行数:14,代码来源:MecanexUserRequest.php

示例4: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     if (Request::isMethod('post')) {
         return ['username' => 'required', 'arts' => 'required|integer|min:0|max:5', 'disasters' => 'required|integer|min:0|max:5', 'environment' => 'required|integer|min:0|max:5', 'education' => 'required|integer|min:0|max:5', 'health' => 'required|integer|min:0|max:5', 'lifestyle' => 'required|integer|min:0|max:5', 'media' => 'required|integer|min:0|max:5', 'holidays' => 'required|integer|min:0|max:5', 'politics' => 'required|integer|min:0|max:5', 'religion' => 'required|integer|min:0|max:5', 'society' => 'required|integer|min:0|max:5', 'transportation' => 'required|integer|min:0|max:5', 'wars' => 'required|integer|min:0|max:5', 'work' => 'required|integer|min:0|max:5'];
     }
     if (Request::isMethod('put')) {
         return ['arts' => 'integer|min:0|max:5', 'disasters' => 'integer|min:0|max:5', 'environment' => 'integer|min:0|max:5', 'education' => 'integer|min:0|max:5', 'health' => 'integer|min:0|max:5', 'lifestyle' => 'integer|min:0|max:5', 'media' => 'integer|min:0|max:5', 'holidays' => 'integer|min:0|max:5', 'politics' => 'integer|min:0|max:5', 'religion' => 'integer|min:0|max:5', 'society' => 'integer|min:0|max:5', 'transportation' => 'integer|min:0|max:5', 'wars' => 'integer|min:0|max:5', 'work' => 'integer|min:0|max:5'];
     }
 }
开发者ID:vinPopulaire,项目名称:SPtool,代码行数:14,代码来源:InterestRequest.php

示例5: image

 /**
  * @param Request $request
  * @return $this
  */
 public function image(Request $request)
 {
     $user = Auth::User();
     if ($request->isMethod('POST')) {
         $src = public_path() . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR . $user->profile->image;
         $image = Image::make($src);
         $image->crop($request->get('w'), $request->get('h'), $request->get('x'), $request->get('y'));
         $image->save($src);
         return Redirect::route('profile_path', ['id' => $user->id]);
     }
     return view('profile.image')->with('user', $user);
 }
开发者ID:katzumi,项目名称:talent4startups,代码行数:16,代码来源:ProfileController.php

示例6: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     //$this->uqSlug();
     // $this->sanitizeTags();
     $rules = ['page.slug' => "required|unique:tok3_publisher_pages,slug", 'page.title' => "required"];
     if (isset($uplFile)) {
         foreach ($this->images as $key => $uplFile) {
             if (count($uplFile) == 1) {
                 $rules['images.' . $key] = 'mimes:jpeg,png,gif';
             }
         }
     }
     if (Request::isMethod('patch') || Request::isMethod('put')) {
         unset($rules['page.slug']);
     }
     return $rules;
 }
开发者ID:tok3,项目名称:publisher,代码行数:22,代码来源:PagesEditCreateRequest.php

示例7: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     //debugbar()->addMessage('Another message', 'mylabel');
     if ($this->has('password') || Request::isMethod('post')) {
         //debugbar()->info('- has password: ' . $this->password . '');
         $password_rules = 'required|confirmed|min:6';
         $this->request->set('password', bcrypt($this->password));
         $this->request->set('password_confirmation', bcrypt($this->password));
     } else {
         //debugbar()->error('- no password: '.$this->password.'');
         $password_rules = 'confirmed';
         $this->request->remove('password');
         //second submit
         $this->request->remove('password_confirmation');
         $this->except('password');
         $this->except('password_confirmation');
     }
     return ['name' => 'required|max:255|unique:users,name,' . $this->userid . '', 'email' => 'required|email|max:255|unique:users,email,' . $this->userid . '', 'username' => 'required|max:255|unique:users,username,' . $this->userid . '', 'password' => '' . $password_rules . ''];
 }
开发者ID:wi-development,项目名称:my-framework,代码行数:24,代码来源:UserRequest.php


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