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


PHP Bundle::option方法代碼示例

本文整理匯總了PHP中Laravel\Bundle::option方法的典型用法代碼示例。如果您正苦於以下問題:PHP Bundle::option方法的具體用法?PHP Bundle::option怎麽用?PHP Bundle::option使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Laravel\Bundle的用法示例。


在下文中一共展示了Bundle::option方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: controller

 /**
  * Register a controller with the router.
  *
  * @param  string|array  $controllers
  * @param  string|array  $defaults
  * @param  bool          $https
  * @return void
  */
 public static function controller($controllers, $defaults = 'index', $https = null)
 {
     foreach ((array) $controllers as $identifier) {
         list($bundle, $controller) = Bundle::parse($identifier);
         // First we need to replace the dots with slashes in the controller name
         // so that it is in directory format. The dots allow the developer to use
         // a cleaner syntax when specifying the controller. We will also grab the
         // root URI for the controller's bundle.
         $controller = str_replace('.', '/', $controller);
         $root = Bundle::option($bundle, 'handles');
         // If the controller is a "home" controller, we'll need to also build an
         // index method route for the controller. We'll remove "home" from the
         // route root and setup a route to point to the index method.
         if (ends_with($controller, 'home')) {
             static::root($identifier, $controller, $root);
         }
         // The number of method arguments allowed for a controller is set by a
         // "segments" constant on this class which allows for the developer to
         // increase or decrease the limit on method arguments.
         $wildcards = static::repeat('(:any?)', static::$segments);
         // Once we have the path and root URI we can build a simple route for
         // the controller that should handle a conventional controller route
         // setup of controller/method/segment/segment, etc.
         $pattern = trim("{$root}/{$controller}/{$wildcards}", '/');
         // Finally we can build the "uses" clause and the attributes for the
         // controller route and register it with the router with a wildcard
         // method so it is available on every request method.
         $uses = "{$identifier}@(:1)";
         $attributes = compact('uses', 'defaults', 'https');
         static::register('*', $pattern, $attributes);
     }
 }
開發者ID:shawon922,項目名稱:LaravelBackboneTodoMVC,代碼行數:40,代碼來源:router.php

示例2: controller

 public static function controller($controllers, $defaults = 'index', $https = null)
 {
     foreach ((array) $controllers as $identifier) {
         list($bundle, $controller) = Bundle::parse($identifier);
         $controller = str_replace('.', '/', $controller);
         $root = Bundle::option($bundle, 'handles');
         if (ends_with($controller, 'home')) {
             static::root($identifier, $controller, $root);
         }
         $wildcards = static::repeat('(:any?)', static::$segments);
         $pattern = trim("{$root}/{$controller}/{$wildcards}", '/');
         $uses = "{$identifier}@(:1)";
         $attributes = compact('uses', 'defaults', 'https');
         static::register('*', $pattern, $attributes);
     }
 }
開發者ID:laravelbook,項目名稱:framework3,代碼行數:16,代碼來源:laravel_lite.php


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