本文整理汇总了PHP中App\Http\Requests\Request::route方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::route方法的具体用法?PHP Request::route怎么用?PHP Request::route使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Http\Requests\Request
的用法示例。
在下文中一共展示了Request::route方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$rules = [];
if ('Rukan\\Map\\Http\\Controllers\\MapController@searchMarkers' != Request::route()->getActionName()) {
$rules = ['name' => 'required', 'description' => 'required', 'contact' => 'required', 'type' => 'required', 'lat' => 'required', 'lng' => 'required'];
}
return $rules;
}
示例2: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$act = Request::route('act');
if ($act == 'add') {
return ['name' => 'required|alpha_dash|max:32|unique:user,name', 'password' => 'required|min:6|max:32', 'email' => 'email'];
} else {
return ['name' => 'required|alpha_dash|unique:user,name', 'password' => 'min:6|max:32', 'email' => 'email'];
}
}
示例3: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
$routeParam = isset(Request::route()->user) ? Request::route()->user : null;
$id = $this->user;
if ($routeParam == $id) {
return true;
}
return redirect()->back();
}
示例4: authorize
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
if (Request::route()->getMethods()[0] == 'PATCH') {
$meeting = Request::route()->getParameter('meeting');
if ($meeting->user->id !== Auth::id()) {
return false;
}
}
return true;
}
示例5: rules
/**
* Get the validation rules that apply to the request.
* Dynamically apply rules based on what type of request is being made
*
* @return array
*/
public function rules()
{
switch (Request::route()->getUri()) {
case "login":
$rules = ['name' => 'required|min:3|exists:users,name', 'password' => 'required|min:8|hashed'];
break;
case "register":
$rules = ['name' => 'required|min:3|unique:users', 'email' => 'required|email|unique:users', 'password' => 'required|min:8|confirmed'];
break;
case "forgot/{token}":
$rules = ['password' => 'required|min:8|confirmed'];
break;
// for users/{user}/edit and users/profile
// for users/{user}/edit and users/profile
default:
$rules = [];
break;
}
return $rules;
}
示例6: rules
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$id = Request::route()->parameter('id');
$unique = $id ? 'unique:clients,email,' . $id : 'unique:clients';
return ['email' => 'required|email|' . $unique . '|max:255', 'name' => 'required|max:255', 'company' => 'required|max:255', 'phone' => 'required|max:255', 'cellphone' => 'required|max:255'];
}