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


PHP Router::pattern方法代码示例

本文整理汇总了PHP中Illuminate\Routing\Router::pattern方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::pattern方法的具体用法?PHP Router::pattern怎么用?PHP Router::pattern使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Routing\Router的用法示例。


在下文中一共展示了Router::pattern方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->pattern('id', '[0-9]+');
     $router->pattern('slug', '[a-zA-Z0-9\\-]+');
     $router->pattern('code', '[a-zA-Z0-9]+');
     parent::boot($router);
 }
开发者ID:VisualAppeal,项目名称:stock,代码行数:13,代码来源:RouteServiceProvider.php

示例2: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     $router->pattern('user', '[0-9]+');
     $router->pattern('id', '[0-9]+');
     parent::boot($router);
 }
开发者ID:phumaster,项目名称:uploadImage,代码行数:13,代码来源:RouteServiceProvider.php

示例3: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->pattern('id', '[0-9]+');
     $router->pattern('letter', '[A-Za-z]+');
     parent::boot($router);
     //
 }
开发者ID:nameNotNull,项目名称:laravelapp5.0.2,代码行数:13,代码来源:RouteServiceProvider.php

示例4: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->pattern('id', '[0-9]+');
     $router->pattern('step', '(clone|install|activate|purge)');
     $router->model('log', 'REBELinBLUE\\Deployer\\ServerLog');
     parent::boot($router);
 }
开发者ID:arasmit2453,项目名称:deployer,代码行数:13,代码来源:RouteServiceProvider.php

示例5: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->pattern('id', '[0-9]+');
     // Should handle 32n33-sss-img-dd.png exception
     $router->pattern('image', '(?P<parent>[0-9n]{2,5}-[\\pL-\\pN\\._-]+)-(?P<suffix>img-[0-9]{2}.png)');
     parent::boot($router);
 }
开发者ID:hongpyo,项目名称:l5essential,代码行数:13,代码来源:RouteServiceProvider.php

示例6: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param Router $router
  */
 public function boot(Router $router)
 {
     $router->pattern('id', '[0-9]+');
     $router->pattern('step', '(clone|install|activate|purge)');
     $router->model('log', ServerLog::class);
     parent::boot($router);
 }
开发者ID:rebelinblue,项目名称:deployer,代码行数:12,代码来源:RouteServiceProvider.php

示例7: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->pattern('zipcode', '\\d{5}([\\-]?\\d{4})?');
     $router->pattern('state', '[a-zA-Z]{2}');
     $router->pattern('district', '\\d{1,3}');
     $router->pattern('lat', '^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?)');
     $router->pattern('lng', '[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)');
     parent::boot($router);
 }
开发者ID:edfialk,项目名称:ContactMyReps,代码行数:15,代码来源:RouteServiceProvider.php

示例8: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     // Sets up our routing tokens.
     $router->pattern('board', Board::URI_PATTERN);
     $router->pattern('id', '[1-9]\\d*');
     $router->model('ban', '\\App\\Ban');
     $router->model('board', '\\App\\Board');
     $router->model('post', '\\App\\Post');
     $router->model('report', '\\App\\Report');
     $router->model('role', '\\App\\Role');
     $router->bind('user', function ($value, $route) {
         if (is_numeric($value)) {
             return \App\User::find($value);
         } else {
             if (preg_match('/^[a-z0-9]{1,64}\\.(?P<id>\\d+)$/i', $value, $matches)) {
                 return \App\User::find($matches['id']);
             }
         }
     });
     $router->bind('role', function ($value, $route) {
         if (is_numeric($value)) {
             return \App\Role::find($value);
         } else {
             if (preg_match('/^[a-z0-9]{1,64}\\.(?P<id>\\d+)$/i', $value, $matches)) {
                 return \App\Role::find($matches['id']);
             }
         }
     });
     $router->bind('post_id', function ($value, $route) {
         $board = $route->getParameter('board');
         if (is_numeric($value) && $board instanceof Board) {
             return $board->getThreadByBoardId($value);
         }
     });
     // Binds a matched instance of a {board} as a singleton instance.
     $router->matched(function ($route, $request) {
         // Binds the board to the application if it exists.
         $board = $route->getParameter('board');
         if ($board instanceof Board && $board->exists) {
             $board->applicationSingleton = true;
             //$this->app->instance("\App\Board", $board);
             $this->app->singleton("\\App\\Board", function ($app) use($board) {
                 return $board->load(['assets', 'settings']);
             });
         }
         // Binds the post to the application if it exists.
         $post = $route->getParameter('post_id');
         if ($post instanceof Post && $post->exists) {
             $route->setParameter('post', $post);
             //$this->app->instance("\App\Post", $post);
             $this->app->singleton("\\App\\Post", function ($app) use($post) {
                 return $post;
             });
         }
     });
     parent::boot($router);
 }
开发者ID:JEWSbreaking8chan,项目名称:infinity-next,代码行数:63,代码来源:RouteServiceProvider.php

示例9: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param \Illuminate\Routing\Router $router
  *
  * @return void
  */
 public function boot(Router $router)
 {
     //
     $router->pattern('owner', '[a-zA-Z.0-9_\\-]+');
     $router->pattern('project', '[a-zA-Z.0-9_\\-]+');
     $router->pattern('commitishPath', '.+');
     $router->pattern('commit', '[a-f0-9^]+');
     parent::boot($router);
     $this->registerBindings();
 }
开发者ID:gitaminhq,项目名称:gitamin,代码行数:17,代码来源:RouteServiceProvider.php

示例10: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     $router->pattern('id', '[a-zA-Z0-9]+');
     // Every parametters have the name is 'id' are checked before to action in controller
     parent::boot($router);
 }
开发者ID:quanit94,项目名称:Aiko-web-update,代码行数:13,代码来源:RouteServiceProvider.php

示例11: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->pattern('board', Board::URI_PATTERN);
     $router->model('board', 'App\\Board');
     $router->model('role', 'App\\Role');
     parent::boot($router);
 }
开发者ID:Ryangr0,项目名称:infinity-next,代码行数:13,代码来源:RouteServiceProvider.php

示例12: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->pattern('artist', '[0-9]+');
     $router->pattern('studio', '[-\\w]+');
     $router->pattern('event', '[0-9]+');
     $router->pattern('piece', '[0-9]+');
     $router->pattern('photo', '[0-9]+');
     parent::boot($router);
     $router->model('artist', 'App\\Artist');
     $router->model('piece', 'App\\Piece');
     $router->model('photo', 'App\\Photo');
     $router->bind('studio', function ($slug) {
         return Studio::where('slug', $slug)->firstOrFail();
     });
     $router->model('event', 'App\\Event');
 }
开发者ID:evendev,项目名称:paintstudio,代码行数:22,代码来源:RouteServiceProvider.php

示例13: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     /**
      * Username must be Alphanumeric
      */
     $router->pattern('username', '[0-9a-zA-Z]+');
     parent::boot($router);
 }
开发者ID:Groopy,项目名称:groopyio,代码行数:14,代码来源:RouteServiceProvider.php

示例14: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->model('user', 'Coyote\\User');
     $router->model('post', 'Coyote\\Post');
     $router->model('topic', 'Coyote\\Topic');
     $router->pattern('id', '[0-9]+');
     $router->pattern('forum', '[A-Za-z\\_\\/]+');
     $router->pattern('tag', '([\\p{L}\\p{Mn}0-9\\._+-]+)');
     $router->bind('forum', function ($path) {
         $result = \Coyote\Forum::where('path', $path)->first();
         if (!$result) {
             abort(404);
         }
         return $result;
     });
     parent::boot($router);
 }
开发者ID:furious-programming,项目名称:coyote,代码行数:23,代码来源:RouteServiceProvider.php

示例15: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     $router->pattern('user', '[0-9]+');
     $router->bind('user', function ($value) {
         return User::where('id', $value)->limit(1)->first();
     });
     parent::boot($router);
 }
开发者ID:AdrianoBiolchi,项目名称:lab-painel-defender,代码行数:14,代码来源:RouteServiceProvider.php


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