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


PHP Validator::make方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(PaiementRequest $request)
 {
     $validator = Validator::make($request->all(), ['type_carte' => 'required|alpha', 'numero_carte' => 'required|size:16|alpha_num', 'cryptogramme' => 'required|max:255|alpha_num']);
     if ($validator->fails()) {
         return redirect('post/create')->withErros($validator)->withInput();
     }
 }
开发者ID:AdrienLeveque,项目名称:Room_Project,代码行数:13,代码来源:Client_reservation_paiementController.php

示例2: create

 /**
  * Create a new user
  *
  * https://laravel.com/docs/5.1/validation
  * @param  array $data
  * @return User
  */
 public static function create(array $attributes = [])
 {
     $table = with(new static())->table;
     //$v = self::validator($data);
     $v = Validator::make($attributes, static::$rules);
     $return = null;
     if ($v->passes()) {
         parent::create($attributes);
         $lastid = \DB::getpdo()->lastinsertid();
         $return = $lastid;
     } else {
         //$messages = $v->errors();
         $return = $v;
     }
     return $table;
 }
开发者ID:odenktools,项目名称:stoplite,代码行数:23,代码来源:User.php

示例3: validator

 /**
  * Get a validator for an incoming registration request.
  *
  * @param  array  $data
  * @return \Illuminate\Contracts\Validation\Validator
  */
 protected function validator(array $data)
 {
     return Validator::make($data, ['name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|confirmed|min:6']);
 }
开发者ID:sctape,项目名称:scheduler,代码行数:10,代码来源:AuthController.php

示例4: createValidator

 /**
  * @param $value
  * @param $validator
  *
  * @return mixed
  * @throws \Exception
  */
 protected function createValidator($value, $validator)
 {
     $validator = Validator::make(['email' => 'kieran@hello.com', 'username' => 'kdadler'], ['email' => 'required|email|unique:users', 'username' => 'unique:users']);
     return $validator;
 }
开发者ID:kdadler,项目名称:just_teach,代码行数:12,代码来源:Filter.php

示例5: doLogin

 public function doLogin()
 {
     // validate the info, create rules for the inputs
     $rules = array('email' => 'required|email', 'password' => 'required|alphaNum|min:6');
     // run the validation rules on the inputs from the form
     $validator = Validator::make(Input::all(), $rules);
     // if the validator fails, redirect back to the form
     if ($validator->fails()) {
         return Redirect::to('/')->withErrors($validator)->withInput(Input::except('password'));
         // send back the input (not the password) so that we can repopulate the form
     } else {
         // create our user data for the authentication
         $userdata = array('email' => Input::get('email'), 'password' => Input::get('password'));
         // attempt to do the login
         if (Auth::attempt($userdata)) {
             // validation successful!
             // redirect them to the secure section or whatever
             // return Redirect::to('secure');
             // for now we'll just echo success (even though echoing in a controller is bad)
             echo 'SUCCESS!';
         } else {
             // validation not successful, send back to form
             return Redirect::to('/');
         }
     }
 }
开发者ID:sandrovw64,项目名称:comanda-teste,代码行数:26,代码来源:HomeController.php


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