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


PHP Router::when方法代码示例

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


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

示例1: map

 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function map(Router $router)
 {
     $router->when('admin/contacts*', 'AdminRole');
     $router->bind('contact', function ($value) {
         return Contact::where('id', $value)->first();
     });
     /**
      * API routes
      */
     $router->group(['namespace' => $this->namespace, 'prefix' => 'api'], function ($router) {
         $router->post('contacts/batchUpdate', 'ApiContactsController@batchUpdate');
         $router->post('contacts/batchDelete', 'ApiContactsController@batchDelete');
         $router->post('contacts/setOrder', 'ApiContactsController@setOrder');
         $router->resource('contacts', 'ApiContactsController');
     });
     /**
      * Admin routes
      */
     $router->group(['namespace' => $this->namespace, 'prefix' => 'admin', 'middleware' => ['auth']], function ($router) {
         //List Contact
         $router->get('contacts', ['as' => 'contacts', 'uses' => 'AdminContactsController@getIndex', 'permission' => 'contacts_manage']);
         //Create Contact
         $router->get('contacts/create', ['as' => 'create_contacts', 'uses' => 'AdminContactsController@getCreate', 'permission' => 'contacts_manage']);
         $router->post('contacts', ['as' => 'create_contacts', 'uses' => 'AdminContactsController@postCreate', 'permission' => 'contacts_manage']);
         //Edit Contact
         $router->get('contacts/{id}/edit', ['as' => 'edit', 'uses' => 'AdminContactsController@getEdit', 'permission' => 'contacts_manage']);
         $router->post('contacts/{id}', ['uses' => 'AdminContactsController@postEdit', 'permission' => 'contacts_manage']);
         $router->get('contacts/export', ['uses' => 'AdminContactsController@export', 'permission' => 'contacts_manage']);
         $router->resource('admin/contacts', 'AdminContactsController');
     });
 }
开发者ID:khaledof,项目名称:brikaCms,代码行数:37,代码来源:RouteServiceProvider.php

示例2: when

 /**
  * Register a pattern-based filter with the router.
  *
  * @param string $pattern
  * @param string $name
  * @param array|null $methods
  * @return void 
  * @deprecated since version 5.1.
  * @static 
  */
 public static function when($pattern, $name, $methods = null)
 {
     \Illuminate\Routing\Router::when($pattern, $name, $methods);
 }
开发者ID:satriashp,项目名称:tour,代码行数:14,代码来源:_ide_helper.php

示例3: when

 /**
  * Register a pattern-based filter with the router.
  *
  * @param string     $pattern
  * @param string     $name
  * @param array|null $methods
  *
  * @static
  */
 public static function when($pattern, $name, $methods = NULL)
 {
     return \Illuminate\Routing\Router::when($pattern, $name, $methods);
 }
开发者ID:netxinyi,项目名称:laravel-code-tips,代码行数:13,代码来源:Route.php


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