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


PHP Application::bindShared方法代码示例

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


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

示例1: __construct

 public function __construct(Application $app)
 {
     $this->app = $app;
     $this->app->bindShared('package.publish', function () {
         return new Publish();
     });
     $commands = ['package.publish'];
     $events = $this->app['events'];
     $events->listen('artisan.start', function ($artisan) use($commands) {
         $artisan->resolveCommands($commands);
     });
 }
开发者ID:mvalim,项目名称:package-utils,代码行数:12,代码来源:Container.php

示例2: registerPaths

 /**
  * Register all available paths into the laravel system
  *
  * @param \Illuminate\Contracts\Foundation\Application $app
  * @return Directory
  */
 public function registerPaths($app)
 {
     // only register if tenant directory exists
     if ($this->base()) {
         /*
          * critical priority, load vendors
          */
         if ($this->vendor() && File::exists($this->vendor() . 'autoload.php')) {
             File::requireOnce($this->vendor() . 'autoload.php');
         }
         /*
          * highest priority, load service providers; or possible custom code before any other include from tenant
          */
         if ($this->providers() && File::exists($this->providers())) {
             File::requireOnce($this->providers());
         }
         /*
          * mediocre priority, load additional config files
          */
         if ($this->config() && File::isDirectory($this->config())) {
             foreach (File::allFiles($this->config()) as $path) {
                 $key = File::name($path);
                 $app['config']->set($key, array_merge(require $path, $app['config']->get($key, [])));
             }
         }
         /*
          * lowest priority load view directory
          */
         if ($this->views() && File::isDirectory($this->views())) {
             $app['view']->addLocation($this->views());
         }
         // set cache
         if (File::isDirectory($this->cache())) {
             $app['config']->set('cache.prefix', "{$app['config']->get('cache.prefix')}-{$this->website->id}");
         }
         // @TODO we really can't use cache yet for application cache
         // replaces lang directory
         if ($this->lang() && File::isDirectory($this->lang())) {
             $path = $this->lang();
             $app->bindShared('translation.loader', function ($app) use($path) {
                 return new FileLoader($app['files'], $path);
             });
             $app->bindShared('translator', function ($app) {
                 $translator = new Translator($app['translation.loader'], $app['config']['app.locale']);
                 $translator->setFallback($app['config']['app.fallback_locale']);
                 return $translator;
             });
         }
         // identify a possible routes.php file
         if ($this->routes() && File::exists($this->routes())) {
             File::requireOnce($this->routes());
         }
     }
     return $this;
 }
开发者ID:rpeterson,项目名称:multi-tenant,代码行数:61,代码来源:Directory.php


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