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


PHP Request::input方法代码示例

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


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

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

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

示例3: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     if (Request::input('cat')[0] == 3 or Request::input('cat')[0] == '') {
         return ['cat.0' => 'required', 'published_at' => 'required', 'title' => 'required|min:3|max:255', 'body' => 'required'];
     } else {
         return ['cat.0' => 'required', 'published_at' => 'required', 'title' => 'required|min:3|max:255', 'body' => 'required', 'director' => 'required|min:3|max:50', 'actor' => 'required|min:3|max:100'];
     }
 }
开发者ID:Vatia13,项目名称:megaportal,代码行数:13,代码来源:ArticleRequest.php

示例4: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $role = Auth::user()->role->id;
     if ($role == 1) {
         return true;
     } elseif ($role == 4 || $role == 3) {
         $uer_company_id = Auth::user()->company_id;
         $company_id = Request::input('company_id');
         return $uer_company_id == $company_id;
     }
     return false;
 }
开发者ID:keiwerkgvr,项目名称:salesperformanceindicator,代码行数:17,代码来源:CreateUserRequest.php

示例5: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $isLoggedIn = false;
     if (Auth::check()) {
         $isLoggedIn = true;
     }
     if (Request::input('ArticleUserId')) {
         if (Request::input('ArticleUserId') != Auth::User()->id) {
             $isLoggedIn = false;
         }
     }
     return $isLoggedIn;
 }
开发者ID:adamanything,项目名称:laravelSimpleCrud,代码行数:18,代码来源:createEditArticleRequest.php

示例6: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $rules = [];
     $rules['question.text'] = 'required|min:5';
     $rules['image'] = 'mime:jpeg,png,gif,bmp,tif|max:4096';
     // TODO
     $rules['question.type'] = 'required';
     $rules['answers'] = 'required';
     foreach (Request::input('answers') as $key => $item) {
         $rules['answers.' . $key . '.text'] = 'required';
         $rules['answers.' . $key . '.image'] = 'mime:jpeg,png,gif,bmp,tif|max:4096"';
         // TODO
     }
     // TODO экспорт в XML. Пересмотреть вид простомотра результата теста
     return $rules;
 }
开发者ID:DJZT,项目名称:tezter,代码行数:21,代码来源:Store.php

示例7: rules

 public function rules()
 {
     $method = $this->method();
     $route = \Route::getCurrentRoute()->getPath();
     switch ($method) {
         case 'GET':
         case 'DELETE':
             return [];
         case 'POST':
             //     	if($route == 'api/auth/login')
             //     	{
             //       return [
             //           'email' => 'required',
             //           'password' => 'required',
             //       ];
             //     	}
             //     	else if($route == 'api/auth/forgot')
             //     	{
             //       return [
             //           'email' => 'required',
             //       ];
             //     	}
             //     	else if($route == 'api/system_users/image')
             //     	{
             // return [
             //           'user_image_upload' => 'required|image',
             //       ];
             //     	}
             //     	else if($route == 'api/auth/password')
             //     	{
             // return [
             //           'old_password' => 'required',
             //           'new_password' => 'required',
             //           'confirm_password' => 'required',
             //       ];
             //     	}
             // else
             // {
             return ['language' => 'required|unique:language', 'code' => 'required'];
             //}
         case 'PUT':
             return ['language' => 'unique:language,language,' . \Request::input('id'), 'code' => 'required'];
         case 'PATCH':
         default:
             break;
     }
 }
开发者ID:iqbalmalik89,项目名称:carpool,代码行数:47,代码来源:LanguageRequest.php

示例8: rules

 public function rules()
 {
     $method = $this->method();
     $route = \Route::getCurrentRoute()->getPath();
     switch ($method) {
         case 'GET':
         case 'DELETE':
             return [];
         case 'POST':
             return ['distance_from' => 'required', 'distance_to' => 'required', 'radius' => 'required'];
         case 'PUT':
             return ['distance_from' => 'required' . \Request::input('radius_id'), 'distance_from' => 'required', 'radius' => 'required'];
         case 'PATCH':
         default:
             break;
     }
 }
开发者ID:Dawzz,项目名称:carpool,代码行数:17,代码来源:RadiusRequest.php

示例9: rules

 public function rules()
 {
     $method = $this->method();
     $route = \Route::getCurrentRoute()->getPath();
     switch ($method) {
         case 'GET':
         case 'DELETE':
             return [];
         case 'POST':
             return ['make' => 'required|unique:car_make'];
         case 'PUT':
             return ['email' => 'unique:car_make,make,' . \Request::input('make_id')];
         case 'PATCH':
         default:
             break;
     }
 }
开发者ID:iqbalmalik89,项目名称:carpool,代码行数:17,代码来源:MakeRequest.php

示例10: rules

 public function rules()
 {
     $method = $this->method();
     $route = \Route::getCurrentRoute()->getPath();
     switch ($method) {
         case 'GET':
         case 'DELETE':
             return [];
         case 'POST':
             return ['template_name' => 'required|unique:email_templates', 'subject' => 'required', 'template' => 'required', 'status' => 'required'];
             //}
         case 'PUT':
             return ['template_name' => 'unique:email_templates,template_name,' . \Request::input('id'), 'subject' => 'required', 'template' => 'required', 'status' => 'required'];
         case 'PATCH':
         default:
             break;
     }
 }
开发者ID:iqbalmalik89,项目名称:carpool,代码行数:18,代码来源:EmailRequest.php

示例11: rules

 public function rules()
 {
     $method = $this->method();
     $route = \Route::getCurrentRoute()->getPath();
     switch ($method) {
         case 'GET':
         case 'DELETE':
             return [];
         case 'POST':
             if ($route == 'api/vehicle_type/image') {
                 return ['vehicle_type_image_upload' => 'required|image'];
             } else {
                 return ['vehicle_type' => 'required|unique:vehicle_types', 'pic_path' => 'required', 'category_id' => 'required', 'status' => 'required'];
             }
         case 'PUT':
             return ['vehicle_type' => 'unique:vehicle_types,vehicle_type,' . \Request::input('id'), 'pic_path' => 'required', 'category_id' => 'required', 'status' => 'required'];
         case 'PATCH':
         default:
             break;
     }
 }
开发者ID:iqbalmalik89,项目名称:carpool,代码行数:21,代码来源:VehicleTypeRequest.php

示例12: rules

 public function rules()
 {
     $method = $this->method();
     $route = \Route::getCurrentRoute()->getPath();
     switch ($method) {
         case 'GET':
         case 'DELETE':
             return [];
         case 'POST':
             if ($route == 'api/users/image') {
                 return ['user_image_upload' => 'required|image'];
             } else {
                 return ['first_name' => 'required', 'last_name' => 'required', 'mobile' => 'required', 'email' => 'required|unique:site_users', 'password' => 'required'];
             }
         case 'PUT':
             return ['first_name' => 'required', 'last_name' => 'required', 'mobile' => 'required', 'email' => 'unique:site_users,email,' . \Request::input('user_id')];
         case 'PATCH':
         default:
             break;
     }
 }
开发者ID:iqbalmalik89,项目名称:carpool,代码行数:21,代码来源:UserRequest.php

示例13: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     return ['category_id' => 'required|exists:categories,id', 'name' => 'required|max:255|unique:products,name,' . Request::input('id'), 'description' => 'max:255', 'quantity' => 'required|digits_between:1,1000', 'available' => 'boolean', 'active' => 'boolean', 'price' => 'required|numeric|between:1,1000000000'];
 }
开发者ID:Tisho84,项目名称:laravel-work,代码行数:9,代码来源:ProductRequest.php

示例14: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     return ['nama_project' => 'required', 'nama_lembaga' => 'required', 'tanggal_mulai' => 'required|date', 'tanggal_selesai' => 'required|date|after:' . Request::input('tanggal_mulai'), 'alamat' => 'required'];
 }
开发者ID:nugi,项目名称:SI_Dinas,代码行数:9,代码来源:CreateProjectRequest.php

示例15: setCheckboxes

 /**
  * Set any checkbox fields that might be missing
  */
 protected function setCheckboxes()
 {
     $this->mergeRequest($this->checkboxFields, function ($field) {
         return Request::input($field, 0);
     });
 }
开发者ID:rickselby,项目名称:dragons-helper,代码行数:9,代码来源:Request.php


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