renamed module events

This commit is contained in:
denisdulici 2020-05-14 21:04:39 +03:00
parent e15473cc7e
commit af66baa226
9 changed files with 32 additions and 23 deletions

View File

@ -5,7 +5,7 @@ namespace $MODULE_NAMESPACE$\$STUDLY_NAME$\Listeners;
use App\Events\Module\Installed as Event; use App\Events\Module\Installed as Event;
use App\Traits\Permissions; use App\Traits\Permissions;
class InstallModule class FinishInstallation
{ {
use Permissions; use Permissions;

View File

@ -5,7 +5,7 @@ namespace Modules\OfflinePayments\Listeners;
use App\Events\Module\Installed as Event; use App\Events\Module\Installed as Event;
use App\Traits\Permissions; use App\Traits\Permissions;
class InstallModule class FinishInstallation
{ {
use Permissions; use Permissions;

View File

@ -4,7 +4,7 @@ namespace Modules\OfflinePayments\Listeners;
use App\Events\Module\PaymentMethodShowing as Event; use App\Events\Module\PaymentMethodShowing as Event;
class ShowPaymentMethod class ShowAsPaymentMethod
{ {
/** /**
* Handle the event. * Handle the event.

View File

@ -4,7 +4,7 @@ namespace Modules\OfflinePayments\Listeners;
use App\Events\Module\SettingShowing as Event; use App\Events\Module\SettingShowing as Event;
class ShowSetting class ShowInSettingsPage
{ {
/** /**
* Handle the event. * Handle the event.

View File

@ -3,9 +3,9 @@
namespace Modules\OfflinePayments\Providers; namespace Modules\OfflinePayments\Providers;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as Provider; use Illuminate\Foundation\Support\Providers\EventServiceProvider as Provider;
use Modules\OfflinePayments\Listeners\InstallModule; use Modules\OfflinePayments\Listeners\FinishInstallation;
use Modules\OfflinePayments\Listeners\ShowPaymentMethod; use Modules\OfflinePayments\Listeners\ShowAsPaymentMethod;
use Modules\OfflinePayments\Listeners\ShowSetting; use Modules\OfflinePayments\Listeners\ShowInSettingsPage;
class Event extends Provider class Event extends Provider
{ {
@ -16,13 +16,13 @@ class Event extends Provider
*/ */
protected $listen = [ protected $listen = [
\App\Events\Module\Installed::class => [ \App\Events\Module\Installed::class => [
InstallModule::class, FinishInstallation::class,
], ],
\App\Events\Module\PaymentMethodShowing::class => [ \App\Events\Module\PaymentMethodShowing::class => [
ShowPaymentMethod::class, ShowAsPaymentMethod::class,
], ],
\App\Events\Module\SettingShowing::class => [ \App\Events\Module\SettingShowing::class => [
ShowSetting::class, ShowInSettingsPage::class,
], ],
]; ];
} }

View File

@ -4,7 +4,7 @@ namespace Modules\PaypalStandard\Listeners;
use App\Events\Module\PaymentMethodShowing as Event; use App\Events\Module\PaymentMethodShowing as Event;
class ShowPaymentMethod class ShowAsPaymentMethod
{ {
/** /**
* Handle the event. * Handle the event.

View File

@ -0,0 +1,20 @@
<?php
namespace Modules\PaypalStandard\Providers;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as Provider;
use Modules\PaypalStandard\Listeners\ShowAsPaymentMethod;
class Event extends Provider
{
/**
* The event listener mappings for the module.
*
* @var array
*/
protected $listen = [
\App\Events\Module\PaymentMethodShowing::class => [
ShowAsPaymentMethod::class,
],
];
}

View File

@ -3,7 +3,6 @@
namespace Modules\PaypalStandard\Providers; namespace Modules\PaypalStandard\Providers;
use Illuminate\Support\ServiceProvider as Provider; use Illuminate\Support\ServiceProvider as Provider;
use Modules\PaypalStandard\Listeners\ShowPaymentMethod;
class Main extends Provider class Main extends Provider
{ {
@ -16,7 +15,6 @@ class Main extends Provider
{ {
$this->loadTranslations(); $this->loadTranslations();
$this->loadViews(); $this->loadViews();
$this->loadEvents();
} }
/** /**
@ -49,16 +47,6 @@ class Main extends Provider
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'paypal-standard'); $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'paypal-standard');
} }
/**
* Load events.
*
* @return void
*/
public function loadEvents()
{
$this->app['events']->listen(\App\Events\Module\PaymentMethodShowing::class, ShowPaymentMethod::class);
}
/** /**
* Load routes. * Load routes.
* *

View File

@ -5,6 +5,7 @@
"category": "payment-method", "category": "payment-method",
"active": 1, "active": 1,
"providers": [ "providers": [
"Modules\\PaypalStandard\\Providers\\Event",
"Modules\\PaypalStandard\\Providers\\Main" "Modules\\PaypalStandard\\Providers\\Main"
], ],
"aliases": {}, "aliases": {},