mirror of
https://github.com/flarum/core.git
synced 2025-10-15 08:55:53 +02:00
Rename app
to container (#2609)
* Rename `app` helper to `resolve`, deprecate old version * Rename $this->app to $this->container in service providers We no longer couple Flarum\Foundation\Application to the Laravel container; instead, we use the container separately. Changing our naming to reflect that will make things clearer.
This commit is contained in:
committed by
GitHub
parent
15cbe4daaa
commit
c81f629b0b
@@ -20,13 +20,13 @@ class FrontendServiceProvider extends AbstractServiceProvider
|
||||
{
|
||||
public function register()
|
||||
{
|
||||
$this->app->singleton('flarum.assets.factory', function () {
|
||||
$this->container->singleton('flarum.assets.factory', function () {
|
||||
return function (string $name) {
|
||||
$paths = $this->app[Paths::class];
|
||||
$paths = $this->container[Paths::class];
|
||||
|
||||
$assets = new Assets(
|
||||
$name,
|
||||
$this->app->make('filesystem')->disk('flarum-assets'),
|
||||
$this->container->make('filesystem')->disk('flarum-assets'),
|
||||
$paths->storage
|
||||
);
|
||||
|
||||
@@ -41,17 +41,17 @@ class FrontendServiceProvider extends AbstractServiceProvider
|
||||
};
|
||||
});
|
||||
|
||||
$this->app->singleton('flarum.frontend.factory', function () {
|
||||
$this->container->singleton('flarum.frontend.factory', function () {
|
||||
return function (string $name) {
|
||||
$frontend = $this->app->make(Frontend::class);
|
||||
$frontend = $this->container->make(Frontend::class);
|
||||
|
||||
$frontend->content(function (Document $document) use ($name) {
|
||||
$document->layoutView = 'flarum::frontend.'.$name;
|
||||
});
|
||||
|
||||
$frontend->content($this->app->make(Content\Assets::class)->forFrontend($name));
|
||||
$frontend->content($this->app->make(Content\CorePayload::class));
|
||||
$frontend->content($this->app->make(Content\Meta::class));
|
||||
$frontend->content($this->container->make(Content\Assets::class)->forFrontend($name));
|
||||
$frontend->content($this->container->make(Content\CorePayload::class));
|
||||
$frontend->content($this->container->make(Content\Meta::class));
|
||||
|
||||
return $frontend;
|
||||
};
|
||||
@@ -65,9 +65,9 @@ class FrontendServiceProvider extends AbstractServiceProvider
|
||||
{
|
||||
$this->loadViewsFrom(__DIR__.'/../../views', 'flarum');
|
||||
|
||||
$this->app->make(ViewFactory::class)->share([
|
||||
'translator' => $this->app->make('translator'),
|
||||
'url' => $this->app->make(UrlGenerator::class)
|
||||
$this->container->make(ViewFactory::class)->share([
|
||||
'translator' => $this->container->make('translator'),
|
||||
'url' => $this->container->make(UrlGenerator::class)
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ class FrontendServiceProvider extends AbstractServiceProvider
|
||||
private function addLessVariables(SourceCollector $sources)
|
||||
{
|
||||
$sources->addString(function () {
|
||||
$settings = $this->app->make(SettingsRepositoryInterface::class);
|
||||
$settings = $this->container->make(SettingsRepositoryInterface::class);
|
||||
|
||||
$vars = [
|
||||
'config-primary-color' => $settings->get('theme_primary_color', '#000'),
|
||||
|
Reference in New Issue
Block a user