本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}