• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Routing\Router类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: map

 public function map(Router $router)
 {
     $router->group(['prefix' => 'vendor-girolando', 'namespace' => 'Girolando\\Componentes\\Animal\\Http\\Controllers'], function () use($router) {
         $router->resource('componentes/animal', 'AnimalServiceController', ['only' => ['index']]);
         $router->resource('server/componentes/animal', 'Server\\AnimalServiceController', ['only' => ['index']]);
     });
 }
开发者ID:girolando,项目名称:componente-animal,代码行数:7,代码来源:AnimalProvider.php


示例2: map

 /**
  * Define the routes for the application.
  *
  * @param \Illuminate\Routing\Router $router
  */
 public function map(Router $router)
 {
     $this->configureAPIRoute();
     $router->group(['namespace' => $this->namespace], function ($router) {
         require app_path('Http/routes.php');
     });
 }
开发者ID:bitqiu,项目名称:sweep-api,代码行数:12,代码来源:RouteServiceProvider.php


示例3: boot

 /**
  * Boot the application events.
  * 
  * @return void
  */
 public function boot(Router $router)
 {
     $router->model('academycycleYear', '\\Modules\\Academycycle\\Entities\\AcademycycleYear');
     $this->registerTranslations();
     $this->registerConfig();
     $this->registerViews();
 }
开发者ID:hisambahaa,项目名称:DARES,代码行数:12,代码来源:AcademycycleServiceProvider.php


示例4: map

 /**
  * Define the routes for the application.
  *
  * @param \Illuminate\Routing\Router $router
  *
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace], function (Router $router) {
         /*
          * Admin routes
          */
         $router->get('admin/_locale/{locale}', 'LocaleController@setContentLocale')->name('admin::change-locale');
     });
     /*
      * Api routes
      */
     $router->get('admin/duplicate/{alias}/{resource}', function ($alias, $resource) {
         $repository = app(ucfirst($alias));
         $oldItem = $repository::make()->skip()->find($resource);
         $newItem = $oldItem->replicate();
         if (isset($newItem->system_name)) {
             $newItem->system_name .= ' (copy)';
         }
         unset($newItem->translations);
         unset($newItem->translatedAttributes);
         dd($newItem->getAttributes());
         $newItem = $newItem->create($newItem->getAttributes());
         foreach ($oldItem->translations as $translation) {
             $parent_id = $oldItem->getRelationKey();
             $translation->{$parent_id} = $newItem->id;
             if (isset($translation->title)) {
                 $translation->title .= ' (copy)';
             }
             $translation = $translation->replicate();
             $translation->save();
         }
         return redirect(URL::previous());
     });
 }
开发者ID:webfactorybulgaria,项目名称:Core,代码行数:41,代码来源:RouteServiceProvider.php


示例5: map

 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace], function ($router) {
         require app_path('Http/custom_routes.php');
         require app_path('Http/routes.php');
     });
 }
开发者ID:rbmowatt,项目名称:alohalbi.surf,代码行数:13,代码来源:RouteServiceProvider.php


示例6: bindPageRouteGroup

 /**
  * Bind the page route group with group attributes.
  * @param Router $router
  * @param int    $pageId
  * @param string $path
  */
 public function bindPageRouteGroup(Router $router, $pageId, $path)
 {
     $attributes = $this->routeGroupAttributes($path, $pageId);
     $router->group($attributes, function ($router) {
         $this->bindPageRoutes($router);
     });
 }
开发者ID:unstoppablecarl,项目名称:laravel-content-pages,代码行数:13,代码来源:PageRouteBinder.php


示例7: mapWebRoutes

 /**
  * Define the "web" routes for the application.
  *
  * These routes all receive session state, CSRF protection, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 protected function mapWebRoutes(Router $router)
 {
     //dc($this->namespace);
     $router->group(['namespace' => $this->namespace, 'middleware' => 'web'], function ($router) {
         require app_path('Http/routes_public.php');
     });
 }
开发者ID:wi-development,项目名称:my-framework,代码行数:15,代码来源:RoutePublicServiceProvider.php


示例8: makeGroup

 /**
  * Simplify the process of routes registration
  *
  * @param Router $router
  * @param $name
  */
 protected function makeGroup(Router $router, $name)
 {
     $groupOpts = ['namespace' => $this->namespace . '\\' . studly_case($name), 'prefix' => $name, 'middleware' => ['web']];
     $router->group($groupOpts, function ($router) use($name) {
         require app_path('Http/routes/' . $name . '.php');
     });
 }
开发者ID:ionutmilica,项目名称:blogging-platform-laravel5,代码行数:13,代码来源:RouteServiceProvider.php


示例9: map

 /**
  * Define the routes for the application.
  *
  * @param \Illuminate\Routing\Router $router
  *
  * @return void
  */
 public function map(Router $router)
 {
     /* @noinspection PhpUnusedParameterInspection */
     $router->group(['namespace' => $this->namespace], function ($router) {
         require app_path('Http/routes.php');
     });
 }
开发者ID:ihatehandles,项目名称:AbuseIO,代码行数:14,代码来源:RouteServiceProvider.php


示例10: map

 /**
  * Define the routes for the module.
  *
  * @param \Illuminate\Routing\Router $router
  *
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace, 'middleware' => ['web']], function () {
         /** @noinspection PhpIncludeInspection */
         require config('modules.path') . '/Sales/Http/routes.php';
     });
 }
开发者ID:hughgrigg,项目名称:ching-shop,代码行数:14,代码来源:RouteServiceProvider.php


示例11: map

 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function map(Router $router)
 {
     $router->group(['namespace' => $this->namespace], function ($router) {
         require app_path('Http/Modules/Users/routes.php');
         //require __DIR__.'/../routes.php';
     });
 }
开发者ID:edsonrodsilva,项目名称:base-laravel-51,代码行数:13,代码来源:RouteServiceProvider.php


示例12: testResourceRoute

 public function testResourceRoute()
 {
     /* @var Dispatcher $dispatcher */
     $dispatcher = $this->getMock(Dispatcher::class);
     $router = new Router($dispatcher, null);
     $routeHelper = new RouteHelper($router);
     $routeHelper->resource('test', 'TestController')->get('get_test', 'get_test')->post('post_test', 'post_test')->put('put_test', 'put_test')->patch('patch_test', 'patch_test')->delete('delete_test', 'delete_test')->rawGet('rawget', 'rawget')->rawPost('rawpost', 'rawpost')->rawPut('rawput', 'rawput')->rawPatch('rawpatch', 'rawpatch')->rawDelete('rawdelete', 'rawdelete')->done();
     $routes = $router->getRoutes();
     $this->assertRoute($routes, 'test', 'GET', 'TestController@index');
     $this->assertRoute($routes, 'test?' . RouteHelper::PAGINATION_URI, 'GET', 'TestController@index');
     $this->assertRoute($routes, 'test', 'POST', 'TestController@store');
     $this->assertRoute($routes, 'test/{test}', 'GET', 'TestController@show');
     $this->assertRoute($routes, 'test/{test}', 'PUT', 'TestController@update');
     $this->assertRoute($routes, 'test/{test}', 'PATCH', 'TestController@update');
     $this->assertRoute($routes, 'test/{test}', 'DELETE', 'TestController@destroy');
     $this->assertRoute($routes, 'test/{test}/get_test', 'GET', 'TestController@get_test');
     $this->assertRoute($routes, 'test/{test}/post_test', 'POST', 'TestController@post_test');
     $this->assertRoute($routes, 'test/{test}/put_test', 'PUT', 'TestController@put_test');
     $this->assertRoute($routes, 'test/{test}/patch_test', 'PATCH', 'TestController@patch_test');
     $this->assertRoute($routes, 'test/{test}/delete_test', 'DELETE', 'TestController@delete_test');
     $this->assertRoute($routes, 'test/rawget', 'GET', 'TestController@rawget');
     $this->assertRoute($routes, 'test/rawpost', 'POST', 'TestController@rawpost');
     $this->assertRoute($routes, 'test/rawput', 'PUT', 'TestController@rawput');
     $this->assertRoute($routes, 'test/rawpatch', 'PATCH', 'TestController@rawpatch');
     $this->assertRoute($routes, 'test/rawdelete', 'DELETE', 'TestController@rawdelete');
 }
开发者ID:jarischaefer,项目名称:hal-api,代码行数:26,代码来源:ResourceRouteTest.php


示例13: map

 public function map(Router $router)
 {
     $router->group(['prefix' => 'andersonef'], function () use($router) {
         $router->resource('componentes/animal', 'Andersonef\\Componentes\\Animal\\Controllers\\AnimalServiceController', ['only' => ['index']]);
         $router->resource('server/componentes/animal', 'Andersonef\\Componentes\\Animal\\Controllers\\Server\\AnimalServiceController', ['only' => ['index']]);
     });
 }
开发者ID:andersonef,项目名称:ghcomponent-animal,代码行数:7,代码来源:AnimalProvider.php


示例14: map

 /**
  * Define the routes for the application.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function map(Router $router)
 {
     $attributes = array('namespace' => $this->namespace, 'as' => 'admin::', 'prefix' => 'admin');
     $router->group($attributes, function ($router) {
         require 'routes.php';
     });
 }
开发者ID:xjtuwangke,项目名称:laravel-bundles,代码行数:13,代码来源:AdminServiceProvider.php


示例15: boot

 public function boot(Router $router)
 {
     $router->middlewareGroup('api', [\KodiCMS\API\Http\Middleware\VerifyApiToken::class]);
     Auth::viaRequest('token', function ($request) {
         return app(TokenGuard::class)->user($request);
     });
 }
开发者ID:KodiComponents,项目名称:module-api,代码行数:7,代码来源:ModuleServiceProvider.php


示例16: boot

 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot(Router $router)
 {
     $router->bind('article', function ($id) {
         return \App\Article::where('slug', $id)->first();
     });
     parent::boot($router);
 }
开发者ID:belhard-user,项目名称:group2,代码行数:12,代码来源:ModelProviders.php


示例17: mapWebRoutes

 /**
  * Define the "web" routes for the application.
  *
  * These routes all receive session state, CSRF protection, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 protected function mapWebRoutes(Router $router)
 {
     $router->group(['namespace' => $this->namespace, 'middleware' => 'web'], function ($router) {
         require app_path('Http/api_routes.php');
         require app_path('Http/routes.php');
     });
 }
开发者ID:popeJohnPakart,项目名称:laravel,代码行数:15,代码来源:RouteServiceProvider.php


示例18: setupRoutes

 /**
  * Define the routes for the application.
  *
  * @param Router $router
  */
 public function setupRoutes(Router $router)
 {
     $router->group(['namespace' => 'VilniusTechnology\\SymfonysFacade\\Controllers'], function () {
         require __DIR__ . '/Http/routes.php';
     });
     $this->routeManager->addSymfonyRoutes($router);
 }
开发者ID:SerdarSanri,项目名称:symfony-facade,代码行数:12,代码来源:SymfonysFacadeServiceProvider.php


示例19: boot

 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot(Router $router)
 {
     // Tell Laravel where the views for a given namespace are located.
     $this->loadViewsFrom(base_path('vendor/aginev/acl/src/resources/views'), 'acl');
     $this->publishes([base_path('vendor/aginev/acl/src/resources/views') => base_path('resources/views/vendor/acl')], 'views');
     // Publish assets
     $this->publishes([base_path('vendor/aginev/acl/src/public') => public_path('vendor/acl')], 'public');
     // Tell Laravel where the translations for a given namespace are located.
     $this->loadTranslationsFrom(base_path('vendor/aginev/acl/src/resources/lang'), 'acl');
     $this->publishes([base_path('vendor/aginev/acl/src/resources/lang') => base_path('resources/lang/vendor/acl')], 'lang');
     // Merge config
     $this->mergeConfigFrom(base_path('vendor/aginev/acl/src/config/acl.php'), 'acl');
     $this->publishes([base_path('vendor/aginev/acl/src/config/acl.php') => config_path('acl.php')], 'config');
     // Publish migrations
     $this->publishes([base_path('vendor/aginev/acl/src/Database/Migrations/') => base_path('/database/migrations')], 'migrations');
     // Publish seeds
     $this->publishes([base_path('vendor/aginev/acl/src/Database/Seeds/') => base_path('/database/seeds')], 'seeds');
     // Define the ACL route middleware
     $router->middleware('acl', 'Aginev\\Acl\\Http\\Middleware\\Acl');
     /**
      * Including A Routes File From A Service Provider
      * NB! Keep this line at the very end of the method to be able to use the config at routes.php
      */
     include base_path('vendor/aginev/acl/src/Http/routes.php');
 }
开发者ID:aginev,项目名称:acl,代码行数:30,代码来源:AclServiceProvider.php


示例20: map

 /**
  * Map additional routes.
  *
  * @param Router                     $router
  * @param SettingRepositoryInterface $settings
  */
 public function map(Router $router, SettingRepositoryInterface $settings)
 {
     $tag = $settings->value('anomaly.module.posts::tag_segment', 'tag');
     $module = $settings->value('anomaly.module.posts::module_segment', 'posts');
     $category = $settings->value('anomaly.module.posts::category_segment', 'category');
     $permalink = $settings->value('anomaly.module.posts::permalink_structure', ['year', 'month', 'day', 'post']);
     $permalink = implode('}/{', $permalink);
     /**
      * Map the RSS methods.
      */
     $router->any("{$module}/rss/category/{category}.xml", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\RssController@category', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/rss/tag/{tag}.xml", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\RssController@tag', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/rss.xml", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\RssController@recent', 'streams::addon' => 'anomaly.module.posts']);
     /**
      * Map other public routes.
      * Mind the order. Routes are
      * handled first come first serve.
      */
     $router->any("{$module}/{type}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\TypesController@index', 'streams::addon' => 'anomaly.module.posts']);
     $router->any($module, ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\PostsController@index', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/preview/{id}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\PostsController@preview', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/{$tag}/{tag}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\TagsController@index', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/{$category}/{category}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\CategoriesController@index', 'streams::addon' => 'anomaly.module.posts']);
     $router->any("{$module}/{{$permalink}}", ['uses' => 'Anomaly\\PostsModule\\Http\\Controller\\PostsController@show', 'streams::addon' => 'anomaly.module.posts']);
 }
开发者ID:ramcda,项目名称:posts-module,代码行数:31,代码来源:PostsModuleServiceProvider.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Routing\UrlGenerator类代码示例发布时间:2022-05-23
下一篇:
PHP Routing\RouteCollection类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap