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


PHP Controller::validator方法代码示例

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


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

示例1: store

 /**
  * Create a new newsletter instance.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $validate = ['email' => 'required'];
     $validator = Controller::validator($request, $validate);
     if ($validator !== true) {
         return Controller::response(Controller::error(38), 400);
     }
     $isValid = $this->isValid($request);
     if ($isValid !== true) {
         return Controller::response(Controller::error(21), 400);
     }
     $response = $this->newsletter->pushNewsletter($request);
     return Controller::response($response, 200);
 }
开发者ID:blyp,项目名称:blyp.api,代码行数:20,代码来源:NewsletterController.php

示例2: store

 /**
  * Create a new category instance.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $user = JWTAuth::parseToken()->authenticate();
     if (!Controller::supreme($user->role)) {
         return Controller::response(Controller::error(13), 401);
     }
     $validate = ['name' => 'required'];
     $validator = Controller::validator($request, $validate);
     if ($validator !== true) {
         return Controller::response(Controller::error(38), 400);
     }
     $response = $this->category->pushCategory($request);
     return Controller::response($response, 200);
 }
开发者ID:blyp,项目名称:blyp.api,代码行数:20,代码来源:CategoryController.php

示例3: store

 /**
  * @param Request $request
  * @return mixed
  */
 public function store(Request $request)
 {
     $validate = ['email' => 'required|email', 'password' => 'required'];
     $validator = Controller::validator($request, $validate);
     if ($validator !== true) {
         return Controller::response(Controller::error(38), 400);
     }
     $isValid = $this->isValid($request);
     if ($isValid !== true) {
         return Controller::response(Controller::error(21), 400);
     }
     if ($request->hasFile('upload')) {
         $file = $request->file('upload');
         $name = uniqid(rand(), true) . "." . $file->getClientOriginalExtension();
         $file->move('storage/', $name);
         $request['picture'] = url('/storage') . "/" . $name;
     }
     $response = $this->user->pushUser($request);
     return Controller::response($response, 200);
 }
开发者ID:blyp,项目名称:blyp.api,代码行数:24,代码来源:SignupController.php

示例4: store

 /**
  * Create a new user instance.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $user = JWTAuth::parseToken()->authenticate();
     if (!Controller::supreme($user->role)) {
         return Controller::response(Controller::error(13), 401);
     }
     $validate = ['username' => 'required', 'email' => 'required|email', 'password' => 'required'];
     $validator = Controller::validator($request, $validate);
     if ($validator !== true) {
         return Controller::response(Controller::error(38), 400);
     }
     if ($request->hasFile('upload')) {
         $file = $request->file('upload');
         $name = uniqid(rand(), true) . "." . $file->getClientOriginalExtension();
         $file->move('storage/', $name);
         $request['picture'] = url('/storage') . "/" . $name;
     }
     $response = $this->user->pushUser($request);
     return Controller::response($response, 200);
 }
开发者ID:blyp,项目名称:blyp.api,代码行数:26,代码来源:UserController.php


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