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


PHP App::singleton方法代码示例

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


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

示例1: register

 /**
  * @inheritDoc
  */
 public function register()
 {
     $this->mergeConfigFrom($this->configPath, 'ray_emitter');
     App::singleton('rayemitter.store', function () {
         return new Store();
     });
 }
开发者ID:C4Tech,项目名称:laravel-ray-emitter,代码行数:10,代码来源:ServiceProvider.php

示例2: register

 /**
  * @inheritDoc
  */
 public function register()
 {
     App::singleton('c4tech.upload', function () {
         $repo = Config::get('upload.repos.upload', 'C4tech\\Upload\\Repository');
         $repo = Config::get('foundation.repos.upload', $repo);
         return new $repo();
     });
 }
开发者ID:C4Tech,项目名称:laravel-upload,代码行数:11,代码来源:ServiceProvider.php

示例3: register

 /**
  * Register the application services.
  *
  * @return void
  */
 public function register()
 {
     //
     //require_once(__DIR__.'/Providers/Main.php');
     App::singleton('Happybirthday', function ($app) {
         return new Main();
     });
 }
开发者ID:willypuzzle,项目名称:happybirthday,代码行数:13,代码来源:HappybirthdayServiceProvider.php

示例4: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     App::singleton('mandrill.wrapper', function ($app) {
         $apikey = Config::get('laravel-mandrill-wrapper::apikey');
         $mandrill = new \Mandrill($apikey);
         return $mandrill;
     });
 }
开发者ID:kh411d,项目名称:laravel-mandrill-wrapper,代码行数:13,代码来源:LaravelMandrillWrapperServiceProvider.php

示例5: prepareForTests

 protected function prepareForTests()
 {
     parent::prepareForTests();
     App::singleton(UtilsServiceCatalog::ServerConfigurationService, 'StubServerConfigurationService');
     //Route::enableFilters();
     $this->current_realm = Config::get('app.url');
     $user = User::where('identifier', '=', 'sebastian.marcet')->first();
     $this->be($user);
     Session::start();
 }
开发者ID:smarcet,项目名称:openstackid,代码行数:10,代码来源:OAuth2ProtocolTest.php

示例6: registerModuleFacades

 /**
  * Registers the current Model and the current Controllers to the IoC.
  * Required for theirs facades
  */
 public function registerModuleFacades()
 {
     $className = ucfirst($this->module);
     App::bind('platform.core.module.model', function () use($className) {
         $modelName = 'Spescina\\PlatformCore\\Models\\' . $className;
         return new $modelName();
     });
     App::singleton('platform.core.module.controller', function () use($className) {
         $controllerName = 'Spescina\\PlatformCore\\Controllers\\' . $className . 'Controller';
         return new $controllerName();
     });
 }
开发者ID:spescina,项目名称:platform-core,代码行数:16,代码来源:Platform.php

示例7: handle

 /**
  * @param Request $request
  * @param callable $next
  */
 public function handle(Request $request, Closure $next)
 {
     foreach ($request->all() as $parameterName => $value) {
         $keyClass = ucfirst($parameterName);
         if (!is_subclass_of($keyClass, K::class)) {
             continue;
         }
         $keyInstance = new $keyClass($value);
         App::singleton(K1::class, function () use($keyInstance) {
             return $keyInstance;
         });
     }
     return $next($request);
 }
开发者ID:nicolacimmino,项目名称:RIoT,代码行数:18,代码来源:KeysResolver.php

示例8: handle

 /**
  * @param Request $request
  * @param callable $next
  */
 public function handle(Request $request, Closure $next)
 {
     foreach ($request->route()->parameters() as $parameterName => $resourceId) {
         $resourceClassName = ucfirst($parameterName);
         if (!is_subclass_of($resourceClassName, MessagingResource::class)) {
             continue;
         }
         $resourceInstance = new $resourceClassName($resourceId);
         App::singleton(MessagingResource::class, function () use($resourceInstance) {
             return $resourceInstance;
         });
         //$request->route()->setParameter($parameterName, $resourceInstance);
     }
     return $next($request);
 }
开发者ID:nicolacimmino,项目名称:RIoT,代码行数:19,代码来源:ResourceResolver.php

示例9: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     // Register Package
     $this->package('j42/laravel-firebase', null, __DIR__ . '/../../../');
     // Get pseudo-connection from config
     $config = Config::get('database.connections.firebase');
     // Dependency Injection: Main Service
     App::singleton('firebase', function ($app) use($config) {
         return new Client($config);
     });
     // Dependency Injection: Token Provider
     App::bind('firebase.token', function ($app) use($config) {
         return new Token($config['token']);
     });
 }
开发者ID:janboden,项目名称:laravel-firebase,代码行数:20,代码来源:LaravelFirebaseServiceProvider.php

示例10: register

 /**
  * Register the application services.
  *
  * @return void
  */
 public function register()
 {
     App::singleton('Acl', function ($app) {
         return new Acl();
     });
 }
开发者ID:aldozumaran,项目名称:acl,代码行数:11,代码来源:AclServiceProvider.php

示例11: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     App::singleton('pusher', function ($app) {
         return new Pusher(new Client(), config('pusher.server_key'), config('pusher.batch_size'));
     });
 }
开发者ID:vanlonden,项目名称:pusher,代码行数:11,代码来源:PusherServiceProvider.php


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