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