add vacentral plugin scaffolding
This commit is contained in:
@@ -4,3 +4,4 @@
|
|||||||
/*/
|
/*/
|
||||||
!.gitignore
|
!.gitignore
|
||||||
!/Sample/
|
!/Sample/
|
||||||
|
!/vacentral/
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class EventServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
protected $listen = [
|
protected $listen = [
|
||||||
'App\Events\TestEvent' => [
|
'App\Events\TestEvent' => [
|
||||||
'Modules\Sample\Listeners\TestEventListener',
|
'Modules\Sample\Listeners\PirepAcceptedEventListener',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "/sample",
|
"name": "nabeel/sample",
|
||||||
|
"type": "laravel-module",
|
||||||
|
"license": "MIT",
|
||||||
"description": "",
|
"description": "",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "",
|
"name": "Nabeel Shahzad",
|
||||||
"email": ""
|
"email": "gm@nabs.io"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"require": {
|
||||||
|
"joshbrw/laravel-module-installer": "dev-master"
|
||||||
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"laravel": {
|
"laravel": {
|
||||||
"providers": [
|
"providers": [
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => 'vacentral'
|
||||||
|
];
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Sample\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class SampleDatabaseSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
Model::unguard();
|
||||||
|
|
||||||
|
// $this->call("OthersTableSeeder");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Vacentral\Listeners;
|
||||||
|
|
||||||
|
use Log;
|
||||||
|
use App\Events\PirepAccepted;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
|
|
||||||
|
class PirepAcceptedEventListener implements ShouldQueue
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle the event.
|
||||||
|
*/
|
||||||
|
public function handle(PirepAccepted $pirep) {
|
||||||
|
Log::info('Received event', [$pirep]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Sample\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Illuminate\Database\Eloquent\Factory;
|
||||||
|
use Route;
|
||||||
|
|
||||||
|
|
||||||
|
class AppServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
protected $defer = false;
|
||||||
|
protected $moduleSvc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Boot the application events.
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->moduleSvc = app('App\Services\ModuleService');
|
||||||
|
|
||||||
|
$this->registerTranslations();
|
||||||
|
$this->registerConfig();
|
||||||
|
|
||||||
|
$this->registerFactories();
|
||||||
|
$this->loadMigrationsFrom(__DIR__ . '/../Database/migrations');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the service provider.
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register config.
|
||||||
|
*/
|
||||||
|
protected function registerConfig()
|
||||||
|
{
|
||||||
|
$this->publishes([
|
||||||
|
__DIR__.'/../Config/config.php' => config_path('sample.php'),
|
||||||
|
], 'config');
|
||||||
|
|
||||||
|
$this->mergeConfigFrom(
|
||||||
|
__DIR__.'/../Config/config.php', 'sample'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register translations.
|
||||||
|
*/
|
||||||
|
public function registerTranslations()
|
||||||
|
{
|
||||||
|
$langPath = resource_path('lang/modules/sample');
|
||||||
|
|
||||||
|
if (is_dir($langPath)) {
|
||||||
|
$this->loadTranslationsFrom($langPath, 'sample');
|
||||||
|
} else {
|
||||||
|
$this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'sample');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Modules\Vacentral\Providers;
|
||||||
|
|
||||||
|
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||||
|
use App\Events\PirepAccepted;
|
||||||
|
use Modules\Vacentral\Listeners\PirepAcceptedEventListener;
|
||||||
|
|
||||||
|
class EventServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The event listener mappings for the application.
|
||||||
|
*/
|
||||||
|
protected $listen = [
|
||||||
|
PirepAccepted::class => [PirepAcceptedEventListener::class],
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register any events for your application.
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
parent::boot();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"name": "nabeel/vacentral",
|
||||||
|
"license": "MIT",
|
||||||
|
"type": "laravel-module",
|
||||||
|
"description": "",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nabeel Shahzad",
|
||||||
|
"email": "gm@nabs.io"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"joshbrw/laravel-module-installer": "dev-master"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Modules\\Vacentral\\Providers\\AppServiceProvider",
|
||||||
|
"Modules\\Vacentral\\Providers\\EventServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Modules\\vacentral\\": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "phpvms/vacentral",
|
||||||
|
"alias": "vacentral",
|
||||||
|
"description": "",
|
||||||
|
"keywords": [],
|
||||||
|
"active": 1,
|
||||||
|
"order": 0,
|
||||||
|
"providers": [
|
||||||
|
"Modules\\Vacentral\\Providers\\AppServiceProvider",
|
||||||
|
"Modules\\Vacentral\\Providers\\EventServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {},
|
||||||
|
"files": [],
|
||||||
|
"requires": []
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user