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


PHP Request::route方法代码示例

本文整理汇总了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;
 }
开发者ID:khanhpnk,项目名称:hocvet,代码行数:13,代码来源:MarkerRequest.php

示例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'];
     }
 }
开发者ID:jay4497,项目名称:j4cms,代码行数:14,代码来源:UserRequest.php

示例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();
 }
开发者ID:phumaster,项目名称:uploadImage,代码行数:14,代码来源:UpdateCoverPhotoRequest.php

示例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;
 }
开发者ID:aminrpg,项目名称:BBB-webmeetings,代码行数:15,代码来源:MeetingRequest.php

示例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;
 }
开发者ID:playatech,项目名称:weightlifter,代码行数:26,代码来源:UserRequest.php

示例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'];
 }
开发者ID:eliasdevel,项目名称:SoftPayments,代码行数:11,代码来源:ClientRequest.php


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