當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Routing\Router類代碼示例

本文整理匯總了PHP中Illuminate\Routing\Router的典型用法代碼示例。如果您正苦於以下問題:PHP Router類的具體用法?PHP Router怎麽用?PHP Router使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Router類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的Illuminate\Routing\Router類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。