当前位置: 首页>>代码示例>>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;未经允许,请勿转载。