akaunting/modules/OfflinePayment/Providers/OfflinePaymentServiceProvider.php

103 lines
2.3 KiB
PHP
Raw Normal View History

2017-09-14 22:21:00 +03:00
<?php
namespace Modules\OfflinePayment\Providers;
2017-09-14 22:21:00 +03:00
use Illuminate\Support\ServiceProvider;
use App\Events\AdminMenuCreated;
2018-12-18 12:55:19 +03:00
use Modules\OfflinePayment\Listeners\OfflinePaymentAdminMenu;
2017-09-14 22:21:00 +03:00
use App\Events\PaymentGatewayListing;
2018-12-18 12:55:19 +03:00
use Modules\OfflinePayment\Listeners\OfflinePaymentGateway;
2017-09-14 22:21:00 +03:00
class OfflinePaymentServiceProvider extends ServiceProvider
2017-09-14 22:21:00 +03:00
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Boot the application events.
*
* @return void
*/
public function boot()
{
$this->registerTranslations();
$this->registerViews();
2018-12-18 12:55:19 +03:00
$this->registerMigrations();
2017-09-14 22:21:00 +03:00
2018-12-18 12:55:19 +03:00
$this->registerEvents();
2017-09-14 22:21:00 +03:00
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
//
}
/**
* Register views.
*
* @return void
*/
public function registerViews()
{
$viewPath = resource_path('views/modules/offlinepayment');
2017-09-14 22:21:00 +03:00
$sourcePath = __DIR__.'/../Resources/views';
$this->publishes([
$sourcePath => $viewPath
]);
$this->loadViewsFrom(array_merge(array_map(function ($path) {
return $path . '/modules/offlinepayment';
}, \Config::get('view.paths')), [$sourcePath]), 'offlinepayment');
2017-09-14 22:21:00 +03:00
}
/**
* Register translations.
*
* @return void
*/
public function registerTranslations()
{
$langPath = resource_path('lang/modules/offlinepayment');
2017-09-14 22:21:00 +03:00
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, 'offlinepayment');
2017-09-14 22:21:00 +03:00
} else {
$this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'offlinepayment');
2017-09-14 22:21:00 +03:00
}
}
2018-12-18 12:55:19 +03:00
public function registerMigrations()
2017-09-14 22:21:00 +03:00
{
2018-12-18 12:55:19 +03:00
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
}
public function registerEvents()
{
$this->app['events']->listen(AdminMenuCreated::class, OfflinePaymentAdminMenu::class);
$this->app['events']->listen(PaymentGatewayListing::class, OfflinePaymentGateway::class);
2017-09-14 22:21:00 +03:00
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [];
}
}