本文整理汇总了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();
});
}
示例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();
});
}
示例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();
});
}
示例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;
});
}
示例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();
}
示例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();
});
}
示例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);
}
示例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);
}
示例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']);
});
}
示例10: register
/**
* Register the application services.
*
* @return void
*/
public function register()
{
App::singleton('Acl', function ($app) {
return new Acl();
});
}
示例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'));
});
}