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