本文整理汇总了PHP中Illuminate\Cache\Repository::setEventDispatcher方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::setEventDispatcher方法的具体用法?PHP Repository::setEventDispatcher怎么用?PHP Repository::setEventDispatcher使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Cache\Repository
的用法示例。
在下文中一共展示了Repository::setEventDispatcher方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: repository
/**
* Create a new cache repository with the given implementation.
*
* @param \Illuminate\Contracts\Cache\Store $store
* @return \Illuminate\Cache\Repository
*/
public function repository(Store $store)
{
$repository = new Repository($store);
if ($this->app->bound('Illuminate\\Contracts\\Events\\Dispatcher')) {
$repository->setEventDispatcher($this->app['Illuminate\\Contracts\\Events\\Dispatcher']);
}
return $repository;
}
示例2: setEventDispatcher
/**
* Set the event dispatcher instance.
*
* @param \Illuminate\Contracts\Events\Dispatcher $events
* @return void
* @static
*/
public static function setEventDispatcher($events)
{
\Illuminate\Cache\Repository::setEventDispatcher($events);
}
示例3: ConfigRepository
if (file_exists($configFile = __DIR__ . '/../config.php')) {
$app->instance('flarum.config', include $configFile);
}
date_default_timezone_set('UTC');
$app->instance('config', $config = new ConfigRepository(['view' => ['paths' => [realpath(base_path('resources/views'))], 'compiled' => realpath(storage_path() . '/framework/views')], 'mail' => ['driver' => 'mail'], 'cache' => ['default' => 'file', 'stores' => ['file' => ['driver' => 'file', 'path' => storage_path() . '/framework/cache']], 'prefix' => 'flarum'], 'filesystems' => ['default' => 'local', 'cloud' => 's3', 'disks' => ['flarum-avatars' => ['driver' => 'local', 'root' => public_path('assets/avatars')]]]]));
$logger = new Monolog\Logger($app->environment());
$logPath = $app->storagePath() . '/logs/flarum.log';
$handler = new \Monolog\Handler\StreamHandler($logPath, Monolog\Logger::DEBUG);
$handler->setFormatter(new \Monolog\Formatter\LineFormatter(null, null, true, true));
$logger->pushHandler($handler);
$app->instance('log', $logger);
$app->alias('log', 'Psr\\Log\\LoggerInterface');
$app->singleton('cache', function ($app) {
$store = new FileStore(new Filesystem(), storage_path('framework/cache'));
$repository = new Repository($store);
$repository->setEventDispatcher($app->make('events'));
return $repository;
});
$app->alias('cache', 'Illuminate\\Contracts\\Cache\\Repository');
$serviceProviders = ['Flarum\\Core\\DatabaseServiceProvider', 'Flarum\\Core\\Settings\\SettingsServiceProvider', 'Flarum\\Locale\\LocaleServiceProvider', 'Illuminate\\Bus\\BusServiceProvider', 'Illuminate\\Filesystem\\FilesystemServiceProvider', 'Illuminate\\Hashing\\HashServiceProvider', 'Illuminate\\Mail\\MailServiceProvider', 'Illuminate\\View\\ViewServiceProvider', 'Illuminate\\Events\\EventServiceProvider', 'Illuminate\\Validation\\ValidationServiceProvider'];
foreach ($serviceProviders as $provider) {
$app->register(new $provider($app));
}
if (Core::isInstalled()) {
$settings = $app->make('Flarum\\Core\\Settings\\SettingsRepository');
$app->register(new \Flarum\Core\CoreServiceProvider($app));
$config->set('mail.driver', Core::config('mail_driver'));
$config->set('mail.host', Core::config('mail_host'));
$config->set('mail.port', Core::config('mail_port'));
$config->set('mail.from.address', Core::config('mail_from'));
$config->set('mail.from.name', Core::config('forum_title'));