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


PHP Facades\Facade類代碼示例

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


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

示例1: __construct

 public function __construct($values = array())
 {
     parent::__construct();
     static::$app = $this;
     foreach ($values as $key => $value) {
         $this[$key] = $value;
     }
     Facade::setFacadeApplication($this);
     // register the configserviceprovider so we can access the config
     $this->register(new ConfigServiceProvider());
     // grab the providers from the config and load them
     $providers = $this['config']->get('app/providers');
     foreach ($providers as $provider) {
         $this->register(new $provider());
     }
     // set the locale (https://github.com/silexphp/Silex/issues/983)
     $locale = $values['locale'];
     if ($this['translator']) {
         $this['translator']->setlocale($locale);
     }
     // register fieldtypes from config
     $fieldTypesConfig = $this['config']->get('fieldtypes');
     if ($fieldTypesConfig) {
         $this['fieldtypes'] = $this['fieldtypes.factory']->fromConfig($fieldTypesConfig);
     }
     // register contenttypes from config
     $contentTypeConfig = $this['config']->get('contenttypes');
     if ($contentTypeConfig) {
         $this['contenttypes'] = $this['contenttypes.factory']->fromConfig($contentTypeConfig);
     }
 }
開發者ID:vespakoen,項目名稱:bolt-core,代碼行數:31,代碼來源:App.php

示例2: sendRequestThroughRouter

 /**
  * Send the given request through the middleware / router.
  *
  * @param  \Illuminate\Http\Request $request
  *
  * @return \Illuminate\Http\Response
  */
 protected function sendRequestThroughRouter($request)
 {
     $this->app->instance('request', $request);
     Facade::clearResolvedInstance('request');
     $this->bootstrap();
     // If administration panel is attempting to be displayed,
     // we don't need any response
     if (is_admin()) {
         return;
     }
     // Get response on `template_include` filter so the conditional functions work correctly
     add_filter('template_include', function ($template) use($request) {
         // If the template is not index.php, then don't output anything
         if ($template !== get_template_directory() . '/index.php') {
             return $template;
         }
         try {
             $response = (new Pipeline($this->app))->send($request)->through($this->app->shouldSkipMiddleware() ? [] : $this->middleware)->then($this->dispatchToRouter());
         } catch (Exception $e) {
             $this->reportException($e);
             $response = $this->renderException($request, $e);
         } catch (Throwable $e) {
             $this->reportException($e = new FatalThrowableError($e));
             $response = $this->renderException($request, $e);
         }
         $this->app['events']->fire('kernel.handled', [$request, $response]);
         return $template;
     }, PHP_INT_MAX);
 }
開發者ID:laraish,項目名稱:framework,代碼行數:36,代碼來源:Kernel.php

示例3: setUp

 /**
  * Bootstrap the test environemnt:
  * - Create an application instance and register it within itself.
  * - Register the package service provider with the app.
  * - Set the APP facade.
  *
  * @return void
  */
 public function setUp()
 {
     $app = new Application();
     $app->instance('app', $app);
     $app->register('Codesleeve\\LaravelStapler\\LaravelStaplerServiceProvider');
     Facade::setFacadeApplication($app);
 }
開發者ID:domtancredi,項目名稱:laravel-stapler,代碼行數:15,代碼來源:TestCase.php

示例4: bootstrap

 public function bootstrap(Application $app, $config)
 {
     \Illuminate\Support\Facades\Facade::clearResolvedInstances();
     \Illuminate\Support\Facades\Facade::setFacadeApplication($app);
     #注冊別名並設置自動加載器
     \Illuminate\Foundation\AliasLoader::getInstance($config['app_aliases'])->register();
 }
開發者ID:jellycheng,項目名稱:learnlaravel,代碼行數:7,代碼來源:demo.php

示例5: resolveFacadeInstance

 /**
  * {@inheritDoc}
  */
 protected static function resolveFacadeInstance($name)
 {
     if (!is_object($name) && !static::$app->bound($name) && ($instance = static::getFacadeInstance()) !== null) {
         static::$app->instance($name, $instance);
     }
     return parent::resolveFacadeInstance($name);
 }
開發者ID:tysonrude,項目名稱:bloom7,代碼行數:10,代碼來源:Facade.php

示例6: reboot

 /**
  * After each scenario, reboot the kernel.
  */
 public function reboot()
 {
     Facade::clearResolvedInstances();
     $lumen = new LumenBooter($this->app->basePath());
     $this->context->getSession('lumen')->getDriver()->reboot($this->app = $lumen->boot());
     $this->setAppOnContext();
 }
開發者ID:arisro,項目名稱:behat-lumen-extension,代碼行數:10,代碼來源:ApplicationAwareInitializer.php

示例7: getApp

 protected function getApp($service = null)
 {
     if ($service) {
         return Facade::getFacadeApplication()->make($service);
     }
     return Facade::getFacadeApplication();
 }
開發者ID:iyoworks,項目名稱:support,代碼行數:7,代碼來源:AccessAppTrait.php

示例8: register

 public function register()
 {
     $this->app->container->singleton('ioc', function () {
         return new Container();
     });
     Facade::setFacadeApplication($this->app->ioc);
 }
開發者ID:krisanalfa,項目名稱:worx,代碼行數:7,代碼來源:Ioc.php

示例9: create

 public static function create()
 {
     $instance = new self();
     // Swap the Facade app with our container (to use these mocks)
     Facade::setFacadeApplication($instance->app);
     return $instance->app;
 }
開發者ID:nstapelbroek,項目名稱:culpa-laravel-5,代碼行數:7,代碼來源:AppFactory.php

示例10: it_should_get_a_proxy

 /**
  * @test
  */
 public function it_should_get_a_proxy()
 {
     /**
      *
      * Set
      *
      */
     $proxy = m::mock('Iverberk\\Larasearch\\proxy');
     /**
      *
      * Expectation
      *
      */
     Facade::clearResolvedInstances();
     \Husband::clearProxy();
     App::shouldReceive('make')->with('iverberk.larasearch.proxy', m::type('Illuminate\\Database\\Eloquent\\Model'))->andReturn($proxy);
     /**
      *
      *
      * Assertion
      *
      */
     $proxy1 = \Husband::getProxy();
     $this->assertSame($proxy, $proxy1);
     $proxy2 = \Husband::getProxy();
     $this->assertSame($proxy, $proxy2);
 }
開發者ID:geekybeaver,項目名稱:larasearch,代碼行數:30,代碼來源:SearchableTraitTest.php

示例11: sendRequestThroughRouter

 /**
  * Send the given request through the middleware / router.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 protected function sendRequestThroughRouter($request)
 {
     $this->app->instance('request', $request);
     Facade::clearResolvedInstance('request');
     $this->bootstrap();
     return (new Pipeline($this->app))->send($request)->through($this->middleware)->then($this->dispatchToRouter());
 }
開發者ID:fparralejo,項目名稱:btrabajo,代碼行數:13,代碼來源:Kernel.php

示例12: __callStatic

 public static function __callStatic($method, $args)
 {
     // subhelper
     if (empty($args)) {
         return LaravelFacade::getFacadeApplication()->helpers->subhelper($method);
     }
 }
開發者ID:adamsmeat,項目名稱:helpers,代碼行數:7,代碼來源:HelpersFacade.php

示例13: setUp

 public function setUp()
 {
     $app = M::mock('Application');
     $app = $app->shouldReceive('make')->with('path.public')->andReturn('tmp');
     $app = $app->shouldReceive('make')->with('path')->andReturn('tests');
     $app = $app->mock();
     Facade::setFacadeApplication($app);
 }
開發者ID:RHoKAustralia,項目名稱:onaroll21_backend,代碼行數:8,代碼來源:LangJsCommandTest.php

示例14: testMapping

 public function testMapping()
 {
     Facade::setFacadeApplication(new ApplicationStub());
     $configuration = ['driver' => 'sqlite', 'database' => 'db', 'username' => 'somedude', 'prefix' => 'mitch_', 'charset' => 'whatevs'];
     $expected = ['driver' => 'pdo_sqlite', 'path' => 'path/database/db.sqlite', 'user' => $configuration['username']];
     $actual = $this->sqlMapper->map($configuration);
     $this->assertEquals($expected, $actual);
 }
開發者ID:jorrit77,項目名稱:laravel-doctrine,代碼行數:8,代碼來源:SqliteMapperTest.php

示例15: sendRequestThroughRouter

 /**
  * Send the given request through the middleware / router.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 protected function sendRequestThroughRouter($request)
 {
     $this->app->instance('request', $request);
     Facade::clearResolvedInstance('request');
     $this->bootstrap();
     $shouldSkipMiddleware = $this->app->bound('middleware.disable') && $this->app->make('middleware.disable') === true;
     return (new Pipeline($this->app))->send($request)->through($shouldSkipMiddleware ? [] : $this->middleware)->then($this->dispatchToRouter());
 }
開發者ID:hilmysyarif,項目名稱:sisfito,代碼行數:14,代碼來源:Kernel.php


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