diff --git a/modules/Vacentral/Config/config.php b/modules/Vacentral/Config/config.php index 05faf7c8..b0e617d3 100644 --- a/modules/Vacentral/Config/config.php +++ b/modules/Vacentral/Config/config.php @@ -1,5 +1,5 @@ 'Vacentral' + 'name' => 'vacentral' ]; diff --git a/modules/Vacentral/Database/seeders/VacentralDatabaseSeeder.php b/modules/Vacentral/Database/seeders/VacentralDatabaseSeeder.php deleted file mode 100644 index 347803ea..00000000 --- a/modules/Vacentral/Database/seeders/VacentralDatabaseSeeder.php +++ /dev/null @@ -1,21 +0,0 @@ -call("OthersTableSeeder"); - } -} diff --git a/modules/Vacentral/Http/Controllers/AdminController.php b/modules/Vacentral/Http/Controllers/AdminController.php deleted file mode 100644 index 8520efe8..00000000 --- a/modules/Vacentral/Http/Controllers/AdminController.php +++ /dev/null @@ -1,63 +0,0 @@ - [ - 'role:admin|user' # leave blank to make this public -]], function() { - - # all your routes are prefixed with the above prefix - # e.g. yoursite.com/sample - Route::get('/', 'VacentralController@index'); - - # This is the admin path. Comment this out if you don't have - # an admin panel component. - Route::group([ - 'middleware' => ['role:admin'], - ], function () { - Route::get('/admin', 'AdminController@index'); - }); -}); diff --git a/modules/Vacentral/Listeners/PirepAcceptedEventListener.php b/modules/Vacentral/Listeners/PirepAcceptedEventListener.php new file mode 100644 index 00000000..b29bedb3 --- /dev/null +++ b/modules/Vacentral/Listeners/PirepAcceptedEventListener.php @@ -0,0 +1,16 @@ +moduleSvc = app('App\Services\ModuleService'); + $this->registerConfig(); + } + + /** + * Register config. + */ + protected function registerConfig() + { + $this->publishes([ + __DIR__.'/../Config/config.php' => config_path('vacentral.php'), + ], 'config'); + + $this->mergeConfigFrom( + __DIR__.'/../Config/config.php', 'vacentral' + ); + } +} diff --git a/modules/Vacentral/Providers/EventServiceProvider.php b/modules/Vacentral/Providers/EventServiceProvider.php index 857f907e..4cddc53b 100644 --- a/modules/Vacentral/Providers/EventServiceProvider.php +++ b/modules/Vacentral/Providers/EventServiceProvider.php @@ -2,8 +2,9 @@ namespace Modules\Vacentral\Providers; +use App\Events\PirepAccepted; use App\Events\TestEvent; -use Modules\Vacentral\Listeners\TestEventListener; +use Modules\Vacentral\Listeners\PirepAcceptedEventListener; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; class EventServiceProvider extends ServiceProvider @@ -12,7 +13,7 @@ class EventServiceProvider extends ServiceProvider * The event listener mappings for the application. */ protected $listen = [ - TestEvent::class => [TestEventListener::class], + PirepAccepted::class => [PirepAcceptedEventListener::class], ]; /** diff --git a/modules/Vacentral/Providers/VacentralServiceProvider.php b/modules/Vacentral/Providers/VacentralServiceProvider.php deleted file mode 100644 index 4703a4eb..00000000 --- a/modules/Vacentral/Providers/VacentralServiceProvider.php +++ /dev/null @@ -1,132 +0,0 @@ -moduleSvc = app('App\Services\ModuleService'); - - $this->registerRoutes(); - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - - $this->registerLinks(); - - $this->registerFactories(); - $this->loadMigrationsFrom(__DIR__ . '/../Database/migrations'); - } - - /** - * Register the service provider. - */ - public function register() - { - // - } - - /** - * Add module links here - */ - public function registerLinks() - { - // Show this link if logged in - // $this->moduleSvc->addFrontendLink('Vacentral', '/vacentral', '', $logged_in=true); - - // Admin links: - $this->moduleSvc->addAdminLink('Vacentral', '/vacentral/admin'); - } - - /** - * Register the routes - */ - protected function registerRoutes() - { - Route::group([ - 'as' => 'vacentral.', - 'prefix' => 'vacentral', - // If you want a RESTful module, change this to 'api' - 'middleware' => ['web'], - 'namespace' => 'Modules\Vacentral\Http\Controllers' - ], function() { - $this->loadRoutesFrom(__DIR__ . '/../Http/routes.php'); - }); - } - - /** - * Register config. - */ - protected function registerConfig() - { - $this->publishes([ - __DIR__.'/../Config/config.php' => config_path('vacentral.php'), - ], 'config'); - - $this->mergeConfigFrom( - __DIR__.'/../Config/config.php', 'vacentral' - ); - } - - /** - * Register views. - */ - public function registerViews() - { - $viewPath = resource_path('views/modules/vacentral'); - $sourcePath = __DIR__.'/../Resources/views'; - - $this->publishes([ - $sourcePath => $viewPath - ],'views'); - - $this->loadViewsFrom(array_merge(array_map(function ($path) { - return $path . '/modules/vacentral'; - }, \Config::get('view.paths')), [$sourcePath]), 'vacentral'); - } - - /** - * Register translations. - */ - public function registerTranslations() - { - $langPath = resource_path('lang/modules/vacentral'); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, 'vacentral'); - } else { - $this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'vacentral'); - } - } - - /** - * Register an additional directory of factories. - * @source https://github.com/sebastiaanluca/laravel-resource-flow/blob/develop/src/Modules/ModuleServiceProvider.php#L66 - */ - public function registerFactories() - { - if (! app()->environment('production')) { - app(Factory::class)->load(__DIR__ . '/../Database/factories'); - } - } - - /** - * Get the services provided by the provider. - */ - public function provides() - { - return []; - } -} diff --git a/modules/Vacentral/Resources/views/admin/index.blade.php b/modules/Vacentral/Resources/views/admin/index.blade.php deleted file mode 100644 index 520940fd..00000000 --- a/modules/Vacentral/Resources/views/admin/index.blade.php +++ /dev/null @@ -1,18 +0,0 @@ -@extends('vacentral::layouts.admin') - -@section('title', 'Vacentral') -@section('actions') -
  • - - - Add New -
  • -@endsection -@section('content') -
    -

    Admin Scaffold!

    -
    -

    This view is loaded from module: {!! config('vacentral.name') !!}

    -
    -
    -@endsection diff --git a/modules/Vacentral/Resources/views/index.blade.php b/modules/Vacentral/Resources/views/index.blade.php deleted file mode 100644 index ec38cd46..00000000 --- a/modules/Vacentral/Resources/views/index.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('vacentral::layouts.frontend') - -@section('content') -

    Hello World

    - -

    - This view is loaded from module: {!! config('vacentral.name') !!} -

    -@endsection diff --git a/modules/Vacentral/Resources/views/layouts/admin.blade.php b/modules/Vacentral/Resources/views/layouts/admin.blade.php deleted file mode 100644 index 421bbe11..00000000 --- a/modules/Vacentral/Resources/views/layouts/admin.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -{{-- -You probably don't want to edit anything here. Just make -sure to extend this in your views. It will pass the content section through ---}} -@extends('admin.app') diff --git a/modules/Vacentral/Resources/views/layouts/frontend.blade.php b/modules/Vacentral/Resources/views/layouts/frontend.blade.php deleted file mode 100644 index 9340e4f9..00000000 --- a/modules/Vacentral/Resources/views/layouts/frontend.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -{{-- -You probably don't want to edit anything here. Just make -sure to extend this in your views. It will pass the content section through ---}} -@extends('layouts.' . config('phpvms.skin') . '.app') diff --git a/modules/Vacentral/composer.json b/modules/Vacentral/composer.json index e9a22256..2c653bdc 100644 --- a/modules/Vacentral/composer.json +++ b/modules/Vacentral/composer.json @@ -10,7 +10,7 @@ "extra": { "laravel": { "providers": [ - "Modules\\Vacentral\\Providers\\VacentralServiceProvider", + "Modules\\Vacentral\\Providers\\AppServiceProvider", "Modules\\Vacentral\\Providers\\EventServiceProvider" ], "aliases": { diff --git a/modules/Vacentral/module.json b/modules/Vacentral/module.json index 24a08c2c..4470b4db 100644 --- a/modules/Vacentral/module.json +++ b/modules/Vacentral/module.json @@ -6,7 +6,7 @@ "active": 1, "order": 0, "providers": [ - "Modules\\Vacentral\\Providers\\VacentralServiceProvider", + "Modules\\Vacentral\\Providers\\AppServiceProvider", "Modules\\Vacentral\\Providers\\EventServiceProvider" ], "aliases": {},