Offline Payment re-factoring

This commit is contained in:
cuneytsenturk
2018-12-18 12:55:19 +03:00
parent 456335e05b
commit df5eb71cbb
32 changed files with 107 additions and 91 deletions

View File

@ -3,13 +3,12 @@
namespace Modules\OfflinePayment\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Factory;
use App\Events\AdminMenuCreated;
use Modules\OfflinePayment\Events\Handlers\OfflinePaymentAdminMenu;
use Modules\OfflinePayment\Listeners\OfflinePaymentAdminMenu;
use App\Events\PaymentGatewayListing;
use Modules\OfflinePayment\Events\Handlers\OfflinePaymentGateway;
use Modules\OfflinePayment\Listeners\OfflinePaymentGateway;
class OfflinePaymentServiceProvider extends ServiceProvider
{
@ -28,14 +27,10 @@ class OfflinePaymentServiceProvider extends ServiceProvider
public function boot()
{
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->registerFactories();
$this->registerMigrations();
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->app['events']->listen(AdminMenuCreated::class, OfflinePaymentAdminMenu::class);
$this->app['events']->listen(PaymentGatewayListing::class, OfflinePaymentGateway::class);
$this->registerEvents();
}
/**
@ -48,21 +43,6 @@ class OfflinePaymentServiceProvider extends ServiceProvider
//
}
/**
* Register config.
*
* @return void
*/
protected function registerConfig()
{
$this->publishes([
__DIR__.'/../Config/config.php' => config_path('offlinepayment.php'),
], 'config');
$this->mergeConfigFrom(
__DIR__.'/../Config/config.php', 'offlinepayment'
);
}
/**
* Register views.
*
@ -99,15 +79,15 @@ class OfflinePaymentServiceProvider extends ServiceProvider
}
}
/**
* Register an additional directory of factories.
* @source https://github.com/sebastiaanluca/laravel-resource-flow/blob/develop/src/Modules/ModuleServiceProvider.php#L66
*/
public function registerFactories()
public function registerMigrations()
{
if (! app()->environment('production')) {
app(Factory::class)->load(__DIR__ . '/Database/factories');
}
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
}
public function registerEvents()
{
$this->app['events']->listen(AdminMenuCreated::class, OfflinePaymentAdminMenu::class);
$this->app['events']->listen(PaymentGatewayListing::class, OfflinePaymentGateway::class);
}
/**