use event discovery for modules
This commit is contained in:
parent
f4d1fe1877
commit
2b42f3168e
@ -3,18 +3,28 @@
|
||||
namespace $MODULE_NAMESPACE$\$STUDLY_NAME$\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as Provider;
|
||||
use $MODULE_NAMESPACE$\$STUDLY_NAME$\Listeners\FinishInstallation;
|
||||
|
||||
class Event extends Provider
|
||||
{
|
||||
/**
|
||||
* The event listener mappings for the module.
|
||||
* Determine if events and listeners should be automatically discovered.
|
||||
*
|
||||
* @var array
|
||||
* @return bool
|
||||
*/
|
||||
protected $listen = [
|
||||
\App\Events\Module\Installed::class => [
|
||||
FinishInstallation::class,
|
||||
],
|
||||
public function shouldDiscoverEvents()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the listener directories that should be used to discover events.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function discoverEventsWithin()
|
||||
{
|
||||
return [
|
||||
__DIR__ . '/../Listeners',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -3,26 +3,28 @@
|
||||
namespace Modules\OfflinePayments\Providers;
|
||||
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as Provider;
|
||||
use Modules\OfflinePayments\Listeners\FinishInstallation;
|
||||
use Modules\OfflinePayments\Listeners\ShowAsPaymentMethod;
|
||||
use Modules\OfflinePayments\Listeners\ShowInSettingsPage;
|
||||
|
||||
class Event extends Provider
|
||||
{
|
||||
/**
|
||||
* The event listener mappings for the module.
|
||||
* Determine if events and listeners should be automatically discovered.
|
||||
*
|
||||
* @var array
|
||||
* @return bool
|
||||
*/
|
||||
protected $listen = [
|
||||
\App\Events\Module\Installed::class => [
|
||||
FinishInstallation::class,
|
||||
],
|
||||
\App\Events\Module\PaymentMethodShowing::class => [
|
||||
ShowAsPaymentMethod::class,
|
||||
],
|
||||
\App\Events\Module\SettingShowing::class => [
|
||||
ShowInSettingsPage::class,
|
||||
],
|
||||
public function shouldDiscoverEvents()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the listener directories that should be used to discover events.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function discoverEventsWithin()
|
||||
{
|
||||
return [
|
||||
__DIR__ . '/../Listeners',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -3,18 +3,28 @@
|
||||
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.
|
||||
* Determine if events and listeners should be automatically discovered.
|
||||
*
|
||||
* @var array
|
||||
* @return bool
|
||||
*/
|
||||
protected $listen = [
|
||||
\App\Events\Module\PaymentMethodShowing::class => [
|
||||
ShowAsPaymentMethod::class,
|
||||
],
|
||||
public function shouldDiscoverEvents()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the listener directories that should be used to discover events.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function discoverEventsWithin()
|
||||
{
|
||||
return [
|
||||
__DIR__ . '/../Listeners',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user