當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。