1
0
mirror of https://github.com/flarum/core.git synced 2025-10-12 23:44:27 +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:
Alexander Skvortsov
2021-03-04 22:14:48 -05:00
committed by GitHub
parent 15cbe4daaa
commit c81f629b0b
29 changed files with 306 additions and 278 deletions

View File

@@ -19,14 +19,14 @@ class NotificationServiceProvider extends AbstractServiceProvider
*/
public function register()
{
$this->app->singleton('flarum.notification.drivers', function () {
$this->container->singleton('flarum.notification.drivers', function () {
return [
'alert' => Driver\AlertNotificationDriver::class,
'email' => Driver\EmailNotificationDriver::class,
];
});
$this->app->singleton('flarum.notification.blueprints', function () {
$this->container->singleton('flarum.notification.blueprints', function () {
return [
DiscussionRenamedBlueprint::class => ['alert']
];
@@ -47,8 +47,8 @@ class NotificationServiceProvider extends AbstractServiceProvider
*/
protected function setNotificationDrivers()
{
foreach ($this->app->make('flarum.notification.drivers') as $driverName => $driver) {
NotificationSyncer::addNotificationDriver($driverName, $this->app->make($driver));
foreach ($this->container->make('flarum.notification.drivers') as $driverName => $driver) {
NotificationSyncer::addNotificationDriver($driverName, $this->container->make($driver));
}
}
@@ -57,7 +57,7 @@ class NotificationServiceProvider extends AbstractServiceProvider
*/
protected function setNotificationTypes()
{
$blueprints = $this->app->make('flarum.notification.blueprints');
$blueprints = $this->container->make('flarum.notification.blueprints');
foreach ($blueprints as $blueprint => $driversEnabledByDefault) {
$this->addType($blueprint, $driversEnabledByDefault);