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