From a3ec21c73d91b394001b07b8ebd98a93a863a1c7 Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Wed, 13 Dec 2017 22:24:41 -0600 Subject: [PATCH] re-add missing stub files --- resources/stubs/modules/command.stub | 68 +++++++++ resources/stubs/modules/composer.stub | 26 ++++ resources/stubs/modules/controller-admin.stub | 63 +++++++++ resources/stubs/modules/controller-plain.stub | 9 ++ resources/stubs/modules/controller.stub | 64 +++++++++ .../stubs/modules/event-service-provider.stub | 25 ++++ resources/stubs/modules/event.stub | 30 ++++ resources/stubs/modules/factory.stub | 9 ++ resources/stubs/modules/job-queued.stub | 34 +++++ resources/stubs/modules/job.stub | 31 ++++ resources/stubs/modules/json.stub | 15 ++ resources/stubs/modules/listener-duck.stub | 30 ++++ .../stubs/modules/listener-queued-duck.stub | 32 +++++ resources/stubs/modules/listener-queued.stub | 33 +++++ resources/stubs/modules/listener-test.stub | 16 +++ resources/stubs/modules/listener.stub | 31 ++++ resources/stubs/modules/mail.stub | 33 +++++ resources/stubs/modules/middleware.stub | 21 +++ resources/stubs/modules/migration/add.stub | 32 +++++ resources/stubs/modules/migration/create.stub | 32 +++++ resources/stubs/modules/migration/delete.stub | 32 +++++ resources/stubs/modules/migration/drop.stub | 32 +++++ resources/stubs/modules/migration/plain.stub | 28 ++++ resources/stubs/modules/model.stub | 10 ++ resources/stubs/modules/notification.stub | 61 ++++++++ resources/stubs/modules/policy.plain.stub | 20 +++ resources/stubs/modules/provider.stub | 35 +++++ resources/stubs/modules/request.stub | 30 ++++ .../stubs/modules/resource-collection.stub | 19 +++ resources/stubs/modules/resource.stub | 19 +++ resources/stubs/modules/route-provider.stub | 41 ++++++ resources/stubs/modules/routes.stub | 18 +++ resources/stubs/modules/rule.stub | 40 ++++++ resources/stubs/modules/scaffold/config.stub | 5 + .../stubs/modules/scaffold/provider.stub | 132 ++++++++++++++++++ resources/stubs/modules/seeder.stub | 21 +++ resources/stubs/modules/start.stub | 17 +++ resources/stubs/modules/unit-test.stub | 19 +++ resources/stubs/modules/views/admin.stub | 5 + resources/stubs/modules/views/frontend.stub | 5 + .../stubs/modules/views/index-admin.stub | 18 +++ resources/stubs/modules/views/index.stub | 9 ++ 42 files changed, 1250 insertions(+) create mode 100644 resources/stubs/modules/command.stub create mode 100644 resources/stubs/modules/composer.stub create mode 100644 resources/stubs/modules/controller-admin.stub create mode 100644 resources/stubs/modules/controller-plain.stub create mode 100644 resources/stubs/modules/controller.stub create mode 100644 resources/stubs/modules/event-service-provider.stub create mode 100644 resources/stubs/modules/event.stub create mode 100644 resources/stubs/modules/factory.stub create mode 100644 resources/stubs/modules/job-queued.stub create mode 100644 resources/stubs/modules/job.stub create mode 100644 resources/stubs/modules/json.stub create mode 100644 resources/stubs/modules/listener-duck.stub create mode 100644 resources/stubs/modules/listener-queued-duck.stub create mode 100644 resources/stubs/modules/listener-queued.stub create mode 100644 resources/stubs/modules/listener-test.stub create mode 100644 resources/stubs/modules/listener.stub create mode 100644 resources/stubs/modules/mail.stub create mode 100644 resources/stubs/modules/middleware.stub create mode 100644 resources/stubs/modules/migration/add.stub create mode 100644 resources/stubs/modules/migration/create.stub create mode 100644 resources/stubs/modules/migration/delete.stub create mode 100644 resources/stubs/modules/migration/drop.stub create mode 100644 resources/stubs/modules/migration/plain.stub create mode 100644 resources/stubs/modules/model.stub create mode 100644 resources/stubs/modules/notification.stub create mode 100644 resources/stubs/modules/policy.plain.stub create mode 100644 resources/stubs/modules/provider.stub create mode 100644 resources/stubs/modules/request.stub create mode 100644 resources/stubs/modules/resource-collection.stub create mode 100644 resources/stubs/modules/resource.stub create mode 100644 resources/stubs/modules/route-provider.stub create mode 100644 resources/stubs/modules/routes.stub create mode 100644 resources/stubs/modules/rule.stub create mode 100644 resources/stubs/modules/scaffold/config.stub create mode 100644 resources/stubs/modules/scaffold/provider.stub create mode 100644 resources/stubs/modules/seeder.stub create mode 100644 resources/stubs/modules/start.stub create mode 100644 resources/stubs/modules/unit-test.stub create mode 100644 resources/stubs/modules/views/admin.stub create mode 100644 resources/stubs/modules/views/frontend.stub create mode 100644 resources/stubs/modules/views/index-admin.stub create mode 100644 resources/stubs/modules/views/index.stub diff --git a/resources/stubs/modules/command.stub b/resources/stubs/modules/command.stub new file mode 100644 index 00000000..e9ef8656 --- /dev/null +++ b/resources/stubs/modules/command.stub @@ -0,0 +1,68 @@ + [TestEventListener::class], + ]; + + /** + * Register any events for your application. + */ + public function boot() + { + parent::boot(); + } +} diff --git a/resources/stubs/modules/event.stub b/resources/stubs/modules/event.stub new file mode 100644 index 00000000..ad1cb696 --- /dev/null +++ b/resources/stubs/modules/event.stub @@ -0,0 +1,30 @@ +define(Model::class, function (Faker $faker) { + return [ + // + ]; +}); diff --git a/resources/stubs/modules/job-queued.stub b/resources/stubs/modules/job-queued.stub new file mode 100644 index 00000000..5bcccf1a --- /dev/null +++ b/resources/stubs/modules/job-queued.stub @@ -0,0 +1,34 @@ +view('view.name'); + } +} diff --git a/resources/stubs/modules/middleware.stub b/resources/stubs/modules/middleware.stub new file mode 100644 index 00000000..954583ed --- /dev/null +++ b/resources/stubs/modules/middleware.stub @@ -0,0 +1,21 @@ +increments('id'); +$FIELDS$ + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('$TABLE$'); + } +} diff --git a/resources/stubs/modules/migration/delete.stub b/resources/stubs/modules/migration/delete.stub new file mode 100644 index 00000000..53ec1b32 --- /dev/null +++ b/resources/stubs/modules/migration/delete.stub @@ -0,0 +1,32 @@ +increments('id'); +$FIELDS$ + $table->timestamps(); + }); + } +} diff --git a/resources/stubs/modules/migration/plain.stub b/resources/stubs/modules/migration/plain.stub new file mode 100644 index 00000000..cc014c60 --- /dev/null +++ b/resources/stubs/modules/migration/plain.stub @@ -0,0 +1,28 @@ +line('The introduction to the notification.') + ->action('Notification Action', 'https://laravel.com') + ->line('Thank you for using our application!'); + } + + /** + * Get the array representation of the notification. + * + * @param mixed $notifiable + * @return array + */ + public function toArray($notifiable) + { + return [ + // + ]; + } +} diff --git a/resources/stubs/modules/policy.plain.stub b/resources/stubs/modules/policy.plain.stub new file mode 100644 index 00000000..02e16df3 --- /dev/null +++ b/resources/stubs/modules/policy.plain.stub @@ -0,0 +1,20 @@ +routesAreCached()) { + // require __DIR__ . '$ROUTES_PATH$'; + // } + } +} diff --git a/resources/stubs/modules/routes.stub b/resources/stubs/modules/routes.stub new file mode 100644 index 00000000..352f275f --- /dev/null +++ b/resources/stubs/modules/routes.stub @@ -0,0 +1,18 @@ + [ + '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('/', '$STUDLY_NAME$Controller@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/resources/stubs/modules/rule.stub b/resources/stubs/modules/rule.stub new file mode 100644 index 00000000..9b716321 --- /dev/null +++ b/resources/stubs/modules/rule.stub @@ -0,0 +1,40 @@ + '$STUDLY_NAME$' +]; diff --git a/resources/stubs/modules/scaffold/provider.stub b/resources/stubs/modules/scaffold/provider.stub new file mode 100644 index 00000000..b4b24d01 --- /dev/null +++ b/resources/stubs/modules/scaffold/provider.stub @@ -0,0 +1,132 @@ +moduleSvc = app('App\Services\ModuleService'); + + $this->registerRoutes(); + $this->registerTranslations(); + $this->registerConfig(); + $this->registerViews(); + + $this->registerLinks(); + + $this->registerFactories(); + $this->loadMigrationsFrom(__DIR__ . '/../$MIGRATIONS_PATH$'); + } + + /** + * Register the service provider. + */ + public function register() + { + // + } + + /** + * Add module links here + */ + public function registerLinks() + { + // Show this link if logged in + // $this->moduleSvc->addFrontendLink('$STUDLY_NAME$', '/$LOWER_NAME$', '', $logged_in=true); + + // Admin links: + $this->moduleSvc->addAdminLink('$STUDLY_NAME$', '/$LOWER_NAME$/admin'); + } + + /** + * Register the routes + */ + protected function registerRoutes() + { + Route::group([ + 'as' => '$LOWER_NAME$.', + 'prefix' => '$LOWER_NAME$', + // If you want a RESTful module, change this to 'api' + 'middleware' => ['web'], + 'namespace' => '$MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers' + ], function() { + $this->loadRoutesFrom(__DIR__ . '/../Http/routes.php'); + }); + } + + /** + * Register config. + */ + protected function registerConfig() + { + $this->publishes([ + __DIR__.'/../$PATH_CONFIG$/config.php' => config_path('$LOWER_NAME$.php'), + ], 'config'); + + $this->mergeConfigFrom( + __DIR__.'/../$PATH_CONFIG$/config.php', '$LOWER_NAME$' + ); + } + + /** + * Register views. + */ + public function registerViews() + { + $viewPath = resource_path('views/modules/$LOWER_NAME$'); + $sourcePath = __DIR__.'/../$PATH_VIEWS$'; + + $this->publishes([ + $sourcePath => $viewPath + ],'views'); + + $this->loadViewsFrom(array_merge(array_map(function ($path) { + return $path . '/modules/$LOWER_NAME$'; + }, \Config::get('view.paths')), [$sourcePath]), '$LOWER_NAME$'); + } + + /** + * Register translations. + */ + public function registerTranslations() + { + $langPath = resource_path('lang/modules/$LOWER_NAME$'); + + if (is_dir($langPath)) { + $this->loadTranslationsFrom($langPath, '$LOWER_NAME$'); + } else { + $this->loadTranslationsFrom(__DIR__ .'/../$PATH_LANG$', '$LOWER_NAME$'); + } + } + + /** + * 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__ . '/../$FACTORIES_PATH$'); + } + } + + /** + * Get the services provided by the provider. + */ + public function provides() + { + return []; + } +} diff --git a/resources/stubs/modules/seeder.stub b/resources/stubs/modules/seeder.stub new file mode 100644 index 00000000..dd434908 --- /dev/null +++ b/resources/stubs/modules/seeder.stub @@ -0,0 +1,21 @@ +call("OthersTableSeeder"); + } +} diff --git a/resources/stubs/modules/start.stub b/resources/stubs/modules/start.stub new file mode 100644 index 00000000..a146e4bd --- /dev/null +++ b/resources/stubs/modules/start.stub @@ -0,0 +1,17 @@ +routesAreCached()) { + require __DIR__ . '$ROUTES_LOCATION$'; +}*/ diff --git a/resources/stubs/modules/unit-test.stub b/resources/stubs/modules/unit-test.stub new file mode 100644 index 00000000..d21c296a --- /dev/null +++ b/resources/stubs/modules/unit-test.stub @@ -0,0 +1,19 @@ +assertTrue(true); + } +} diff --git a/resources/stubs/modules/views/admin.stub b/resources/stubs/modules/views/admin.stub new file mode 100644 index 00000000..421bbe11 --- /dev/null +++ b/resources/stubs/modules/views/admin.stub @@ -0,0 +1,5 @@ +{{-- +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/resources/stubs/modules/views/frontend.stub b/resources/stubs/modules/views/frontend.stub new file mode 100644 index 00000000..9340e4f9 --- /dev/null +++ b/resources/stubs/modules/views/frontend.stub @@ -0,0 +1,5 @@ +{{-- +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/resources/stubs/modules/views/index-admin.stub b/resources/stubs/modules/views/index-admin.stub new file mode 100644 index 00000000..87155e77 --- /dev/null +++ b/resources/stubs/modules/views/index-admin.stub @@ -0,0 +1,18 @@ +@extends('$LOWER_NAME$::layouts.admin') + +@section('title', '$STUDLY_NAME$') +@section('actions') +
  • + + + Add New +
  • +@endsection +@section('content') +
    +

    Admin Scaffold!

    +
    +

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

    +
    +
    +@endsection diff --git a/resources/stubs/modules/views/index.stub b/resources/stubs/modules/views/index.stub new file mode 100644 index 00000000..a8af9394 --- /dev/null +++ b/resources/stubs/modules/views/index.stub @@ -0,0 +1,9 @@ +@extends('$LOWER_NAME$::layouts.frontend') + +@section('content') +

    Hello World

    + +

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

    +@endsection