本文整理汇总了PHP中App\Http\Requests\Request::segment方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::segment方法的具体用法?PHP Request::segment怎么用?PHP Request::segment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Http\Requests\Request
的用法示例。
在下文中一共展示了Request::segment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
if (Request::segment(3) == 'create') {
$this->rules['file_name'] .= '|required';
}
return $this->rules;
}
示例2: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
switch ($this->method()) {
case 'POST':
return ['email' => 'required|email|unique:users,email', 'first_name' => 'required', 'last_name' => 'required', 'password' => 'required'];
case 'PUT':
case 'PATCH':
return ['email' => 'required|email|unique:users,email,' . Request::segment(2) . ',id', 'first_name' => 'required', 'last_name' => 'required'];
break;
default:
break;
}
}
示例3: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
switch ($this->method()) {
case 'POST':
return ['name' => 'required|unique:groups,name|max:50'];
case 'PUT':
case 'PATCH':
return ['name' => 'required|unique:groups,name,' . Request::segment(2) . ',id'];
break;
default:
break;
}
}