add module provider dependencies
This commit is contained in:
parent
786c4be726
commit
aa4c35afbc
@ -41,20 +41,23 @@
|
||||
"symfony/css-selector": "3.1.*",
|
||||
"symfony/dom-crawler": "3.3.*",
|
||||
"phpunit/phpunit": "6.4.0",
|
||||
"scriptfusion/phpunit-immediate-exception-printer": "1.3.0"
|
||||
"scriptfusion/phpunit-immediate-exception-printer": "1.3.0",
|
||||
"nwidart/laravel-modules": "^2.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"fzaninotto/faker": "~1.4",
|
||||
"mockery/mockery": "0.9.*",
|
||||
"laravel/homestead": "v6.2.2",
|
||||
"filp/whoops": "~2.0"
|
||||
"filp/whoops": "~2.0",
|
||||
"orchestra/testbench": "v3.5.2"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"database"
|
||||
],
|
||||
"psr-4": {
|
||||
"App\\": "app/"
|
||||
"App\\": "app/",
|
||||
"Modules\\": "modules/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
|
6337
composer.lock
generated
6337
composer.lock
generated
File diff suppressed because it is too large
Load Diff
127
config/modules.php
Normal file
127
config/modules.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'namespace' => 'Modules',
|
||||
|
||||
'stubs' => [
|
||||
'enabled' => true,
|
||||
'path' => resource_path() . '/modules/stubs',
|
||||
'files' => [
|
||||
'start' => 'start.php',
|
||||
'routes' => 'Http/routes.php',
|
||||
'views/index' => 'Resources/views/index.blade.php',
|
||||
'views/index-admin' => 'Resources/views/admin/index.blade.php',
|
||||
'views/frontend' => 'Resources/views/layouts/frontend.blade.php',
|
||||
'views/admin' => 'Resources/views/layouts/admin.blade.php',
|
||||
'controller-admin' => 'Http/Controllers/AdminController.php',
|
||||
'scaffold/config' => 'Config/config.php',
|
||||
'composer' => 'composer.json',
|
||||
],
|
||||
'replacements' => [
|
||||
'start' => ['LOWER_NAME', 'ROUTES_LOCATION'],
|
||||
'routes' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'],
|
||||
'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'],
|
||||
'views/index' => ['LOWER_NAME'],
|
||||
'views/index-admin' => ['LOWER_NAME', 'STUDLY_NAME'],
|
||||
'views/frontend' => ['STUDLY_NAME'],
|
||||
'views/admin' => ['STUDLY_NAME'],
|
||||
'controller-admin' => ['MODULE_NAMESPACE', 'STUDLY_NAME', 'CLASS_NAMESPACE', 'LOWER_NAME'],
|
||||
'scaffold/config' => ['STUDLY_NAME'],
|
||||
'composer' => [
|
||||
'LOWER_NAME',
|
||||
'STUDLY_NAME',
|
||||
'VENDOR',
|
||||
'AUTHOR_NAME',
|
||||
'AUTHOR_EMAIL',
|
||||
'MODULE_NAMESPACE',
|
||||
],
|
||||
],
|
||||
'gitkeep' => false,
|
||||
],
|
||||
'paths' => [
|
||||
'modules' => base_path('modules'),
|
||||
'assets' => public_path('modules'),
|
||||
'migration' => base_path('database/migrations'),
|
||||
'generator' => [
|
||||
'config' => ['path' => 'Config', 'generate' => true],
|
||||
'command' => ['path' => 'Console', 'generate' => true],
|
||||
'migration' => ['path' => 'Database/migrations', 'generate' => true],
|
||||
'seeder' => ['path' => 'Database/seeders', 'generate' => true],
|
||||
'factory' => ['path' => 'Database/factories', 'generate' => true],
|
||||
'model' => ['path' => 'Models', 'generate' => true],
|
||||
'controller' => ['path' => 'Http/Controllers', 'generate' => true],
|
||||
'filter' => ['path' => 'Http/Middleware', 'generate' => true],
|
||||
'request' => ['path' => 'Http/Requests', 'generate' => true],
|
||||
'provider' => ['path' => 'Providers', 'generate' => true],
|
||||
'assets' => ['path' => 'Resources/assets', 'generate' => true],
|
||||
'lang' => ['path' => 'Resources/lang', 'generate' => true],
|
||||
'views' => ['path' => 'Resources/views', 'generate' => true],
|
||||
'test' => ['path' => 'tests', 'generate' => true],
|
||||
'repository' => ['path' => 'Repositories', 'generate' => false],
|
||||
'event' => ['path' => 'Events', 'generate' => false],
|
||||
'listener' => ['path' => 'Listeners', 'generate' => false],
|
||||
'policies' => ['path' => 'Policies', 'generate' => false],
|
||||
'rules' => ['path' => 'Rules', 'generate' => false],
|
||||
'jobs' => ['path' => 'Jobs', 'generate' => false],
|
||||
'emails' => ['path' => 'Resources/Emails', 'generate' => false],
|
||||
'notifications' => ['path' => 'Notifications', 'generate' => false],
|
||||
'resource' => ['path' => 'Models/Transformers', 'generate' => false],
|
||||
],
|
||||
],
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Scan Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you define which folder will be scanned. By default will scan vendor
|
||||
| directory. This is useful if you host the package in packagist website.
|
||||
|
|
||||
*/
|
||||
|
||||
'scan' => [
|
||||
'enabled' => false,
|
||||
'paths' => [
|
||||
base_path('vendor/*/*'),
|
||||
],
|
||||
],
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Composer File Template
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is the config for composer.json file, generated by this package
|
||||
|
|
||||
*/
|
||||
|
||||
'composer' => [
|
||||
'vendor' => '',
|
||||
'author' => [
|
||||
'name' => '',
|
||||
'email' => '',
|
||||
],
|
||||
],
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Caching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is the config for setting up caching feature.
|
||||
|
|
||||
*/
|
||||
'cache' => [
|
||||
'enabled' => true,
|
||||
'key' => 'phpvms-modules',
|
||||
'lifetime' => 60,
|
||||
],
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Choose what laravel-modules will register as custom namespaces.
|
||||
| Setting one to false will require you to register that part
|
||||
| in your own Service Provider class.
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'register' => [
|
||||
'translations' => true,
|
||||
],
|
||||
];
|
6
modules/.gitignore
vendored
Normal file
6
modules/.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
# Ignore everything so if we update via git, nothing is overwritten
|
||||
*
|
||||
|
||||
# But keep the sample and this file around
|
||||
!.gitignore
|
||||
!Sample
|
68
resources/modules/stubs/command.stub
Normal file
68
resources/modules/stubs/command.stub
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
|
||||
class $CLASS$ extends Command
|
||||
{
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = '$COMMAND_NAME$';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description.';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArguments()
|
||||
{
|
||||
return [
|
||||
['example', InputArgument::REQUIRED, 'An example argument.'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return [
|
||||
['example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null],
|
||||
];
|
||||
}
|
||||
}
|
25
resources/modules/stubs/composer.stub
Normal file
25
resources/modules/stubs/composer.stub
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "$VENDOR$/$LOWER_NAME$",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "$AUTHOR_NAME$",
|
||||
"email": "$AUTHOR_EMAIL$"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\$STUDLY_NAME$ServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\": ""
|
||||
}
|
||||
}
|
||||
}
|
63
resources/modules/stubs/controller-admin.stub
Normal file
63
resources/modules/stubs/controller-admin.stub
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace $MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\AppBaseController;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
class AdminController extends AppBaseController
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('$LOWER_NAME$::admin.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('$LOWER_NAME$::admin.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show()
|
||||
{
|
||||
return view('$LOWER_NAME$::admin.show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
return view('$LOWER_NAME$::admin.edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy()
|
||||
{
|
||||
}
|
||||
}
|
9
resources/modules/stubs/controller-plain.stub
Normal file
9
resources/modules/stubs/controller-plain.stub
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace $CLASS_NAMESPACE$;
|
||||
|
||||
use Illuminate\Routing\Controller;
|
||||
|
||||
class $CLASS$ extends Controller
|
||||
{
|
||||
}
|
64
resources/modules/stubs/controller.stub
Normal file
64
resources/modules/stubs/controller.stub
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace $CLASS_NAMESPACE$;
|
||||
|
||||
use App\Http\Controllers\AppBaseController;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
|
||||
class $CLASS$ extends AppBaseController
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('$LOWER_NAME$::index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('$LOWER_NAME$::create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param Request $request
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show()
|
||||
{
|
||||
return view('$LOWER_NAME$::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
return view('$LOWER_NAME$::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy()
|
||||
{
|
||||
}
|
||||
}
|
30
resources/modules/stubs/event.stub
Normal file
30
resources/modules/stubs/event.stub
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class $CLASS$
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the channels the event should be broadcast on.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function broadcastOn()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
9
resources/modules/stubs/factory.stub
Normal file
9
resources/modules/stubs/factory.stub
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(Model::class, function (Faker $faker) {
|
||||
return [
|
||||
//
|
||||
];
|
||||
});
|
34
resources/modules/stubs/job-queued.stub
Normal file
34
resources/modules/stubs/job-queued.stub
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
||||
class $CLASS$ implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
31
resources/modules/stubs/job.stub
Normal file
31
resources/modules/stubs/job.stub
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
||||
class $CLASS$ implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, Queueable;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
16
resources/modules/stubs/json.stub
Normal file
16
resources/modules/stubs/json.stub
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "$STUDLY_NAME$",
|
||||
"alias": "$LOWER_NAME$",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"active": 1,
|
||||
"order": 0,
|
||||
"providers": [
|
||||
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\$STUDLY_NAME$ServiceProvider"
|
||||
],
|
||||
"aliases": {},
|
||||
"files": [
|
||||
"start.php"
|
||||
],
|
||||
"requires": []
|
||||
}
|
30
resources/modules/stubs/listener-duck.stub
Normal file
30
resources/modules/stubs/listener-duck.stub
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class $CLASS$
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param object $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
32
resources/modules/stubs/listener-queued-duck.stub
Normal file
32
resources/modules/stubs/listener-queued-duck.stub
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class $CLASS$ implements ShouldQueue
|
||||
{
|
||||
use InteractsWithQueue;
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param object $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle($event)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
33
resources/modules/stubs/listener-queued.stub
Normal file
33
resources/modules/stubs/listener-queued.stub
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use $EVENTNAME$;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class $CLASS$ implements ShouldQueue
|
||||
{
|
||||
use InteractsWithQueue;
|
||||
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param $SHORTEVENTNAME$ $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle($SHORTEVENTNAME$ $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
31
resources/modules/stubs/listener.stub
Normal file
31
resources/modules/stubs/listener.stub
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use $EVENTNAME$;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class $CLASS$
|
||||
{
|
||||
/**
|
||||
* Create the event listener.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param $SHORTEVENTNAME$ $event
|
||||
* @return void
|
||||
*/
|
||||
public function handle($SHORTEVENTNAME$ $event)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
33
resources/modules/stubs/mail.stub
Normal file
33
resources/modules/stubs/mail.stub
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
|
||||
class $CLASS$ extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the message.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function build()
|
||||
{
|
||||
return $this->view('view.name');
|
||||
}
|
||||
}
|
21
resources/modules/stubs/middleware.stub
Normal file
21
resources/modules/stubs/middleware.stub
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class $CLASS$
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
return $next($request);
|
||||
}
|
||||
}
|
32
resources/modules/stubs/migration/add.stub
Normal file
32
resources/modules/stubs/migration/add.stub
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class $CLASS$ extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('$TABLE$', function (Blueprint $table) {
|
||||
$FIELDS_UP$
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('$TABLE$', function (Blueprint $table) {
|
||||
$FIELDS_DOWN$
|
||||
});
|
||||
}
|
||||
}
|
32
resources/modules/stubs/migration/create.stub
Normal file
32
resources/modules/stubs/migration/create.stub
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class $CLASS$ extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('$TABLE$', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$FIELDS$
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('$TABLE$');
|
||||
}
|
||||
}
|
32
resources/modules/stubs/migration/delete.stub
Normal file
32
resources/modules/stubs/migration/delete.stub
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class $CLASS$ extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('$TABLE$', function (Blueprint $table) {
|
||||
$FIELDS_UP$
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('$TABLE$', function (Blueprint $table) {
|
||||
$FIELDS_DOWN$
|
||||
});
|
||||
}
|
||||
}
|
32
resources/modules/stubs/migration/drop.stub
Normal file
32
resources/modules/stubs/migration/drop.stub
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class $CLASS$ extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('$TABLE$');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::create('$TABLE$', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$FIELDS$
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
}
|
28
resources/modules/stubs/migration/plain.stub
Normal file
28
resources/modules/stubs/migration/plain.stub
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class $CLASS$ extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
10
resources/modules/stubs/model.stub
Normal file
10
resources/modules/stubs/model.stub
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class $CLASS$ extends Model
|
||||
{
|
||||
protected $fillable = $FILLABLE$;
|
||||
}
|
61
resources/modules/stubs/notification.stub
Normal file
61
resources/modules/stubs/notification.stub
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
|
||||
class $CLASS$ extends Notification
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
/**
|
||||
* Create a new notification instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the notification's delivery channels.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return array
|
||||
*/
|
||||
public function via($notifiable)
|
||||
{
|
||||
return ['mail'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
return (new MailMessage)
|
||||
->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 [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
20
resources/modules/stubs/policy.plain.stub
Normal file
20
resources/modules/stubs/policy.plain.stub
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Auth\Access\HandlesAuthorization;
|
||||
|
||||
class $CLASS$
|
||||
{
|
||||
use HandlesAuthorization;
|
||||
|
||||
/**
|
||||
* Create a new policy instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
35
resources/modules/stubs/provider.stub
Normal file
35
resources/modules/stubs/provider.stub
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class $CLASS$ extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = false;
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
30
resources/modules/stubs/request.stub
Normal file
30
resources/modules/stubs/request.stub
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class $CLASS$ extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
19
resources/modules/stubs/resource-collection.stub
Normal file
19
resources/modules/stubs/resource-collection.stub
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Http\Resources\Json\ResourceCollection;
|
||||
|
||||
class $CLASS$ extends ResourceCollection
|
||||
{
|
||||
/**
|
||||
* Transform the resource collection into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return parent::toArray($request);
|
||||
}
|
||||
}
|
19
resources/modules/stubs/resource.stub
Normal file
19
resources/modules/stubs/resource.stub
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Http\Resources\Json\Resource;
|
||||
|
||||
class $CLASS$ extends Resource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return parent::toArray($request);
|
||||
}
|
||||
}
|
41
resources/modules/stubs/route-provider.stub
Normal file
41
resources/modules/stubs/route-provider.stub
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class $CLASS$ extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The root namespace to assume when generating URLs to actions.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $rootUrlNamespace = '$MODULE_NAMESPACE$\$MODULE$\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*
|
||||
* @param Router $router
|
||||
* @return void
|
||||
*/
|
||||
public function before(Router $router)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map(Router $router)
|
||||
{
|
||||
// if (!app()->routesAreCached()) {
|
||||
// require __DIR__ . '$ROUTES_PATH$';
|
||||
// }
|
||||
}
|
||||
}
|
24
resources/modules/stubs/routes.stub
Normal file
24
resources/modules/stubs/routes.stub
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
Route::group([
|
||||
'as' => '$LOWER_NAME$.',
|
||||
'prefix' => '$LOWER_NAME$',
|
||||
'middleware' => [
|
||||
'web',
|
||||
'role:admin|user' # leave blank for public
|
||||
],
|
||||
'namespace' => '$MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers'
|
||||
], 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');
|
||||
});
|
||||
});
|
40
resources/modules/stubs/rule.stub
Normal file
40
resources/modules/stubs/rule.stub
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Contracts\Validation\Rule;
|
||||
|
||||
class $CLASS$ implements Rule
|
||||
{
|
||||
/**
|
||||
* Create a new rule instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the validation rule passes.
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return bool
|
||||
*/
|
||||
public function passes($attribute, $value)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation error message.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
return 'The validation error message.';
|
||||
}
|
||||
}
|
5
resources/modules/stubs/scaffold/config.stub
Normal file
5
resources/modules/stubs/scaffold/config.stub
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => '$STUDLY_NAME$'
|
||||
];
|
111
resources/modules/stubs/scaffold/provider.stub
Normal file
111
resources/modules/stubs/scaffold/provider.stub
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Database\Eloquent\Factory;
|
||||
|
||||
class $CLASS$ extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Indicates if loading of the provider is deferred.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $defer = false;
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerRoutes();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->registerFactories();
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../$MIGRATIONS_PATH$');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the routes
|
||||
*/
|
||||
protected function registerRoutes()
|
||||
{
|
||||
$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 [];
|
||||
}
|
||||
}
|
21
resources/modules/stubs/seeder.stub
Normal file
21
resources/modules/stubs/seeder.stub
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class $NAME$ extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Model::unguard();
|
||||
|
||||
// $this->call("OthersTableSeeder");
|
||||
}
|
||||
}
|
17
resources/modules/stubs/start.stub
Normal file
17
resources/modules/stubs/start.stub
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Namespaces And Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When a module starting, this file will executed automatically. This helps
|
||||
| to register some namespaces like translator or view. Also this file
|
||||
| will load the routes file for each module. You may also modify
|
||||
| this file as you want.
|
||||
|
|
||||
*/
|
||||
|
||||
/*if (!app()->routesAreCached()) {
|
||||
require __DIR__ . '$ROUTES_LOCATION$';
|
||||
}*/
|
19
resources/modules/stubs/unit-test.stub
Normal file
19
resources/modules/stubs/unit-test.stub
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
class $CLASS$ extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testExample()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
5
resources/modules/stubs/views/admin.stub
Normal file
5
resources/modules/stubs/views/admin.stub
Normal file
@ -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')
|
5
resources/modules/stubs/views/frontend.stub
Normal file
5
resources/modules/stubs/views/frontend.stub
Normal file
@ -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')
|
18
resources/modules/stubs/views/index-admin.stub
Normal file
18
resources/modules/stubs/views/index-admin.stub
Normal file
@ -0,0 +1,18 @@
|
||||
@extends('$LOWER_NAME$::layouts.admin')
|
||||
|
||||
@section('title', '$STUDLY_NAME$')
|
||||
@section('actions')
|
||||
<li>
|
||||
<a href="{!! url('/$LOWER_NAME$/admin/create') !!}">
|
||||
<i class="ti-plus"></i>
|
||||
Add New</a>
|
||||
</li>
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="header"><h4 class="title">Admin Scaffold!</h4></div>
|
||||
<div class="content">
|
||||
<p>This view is loaded from module: {!! config('$LOWER_NAME$.name') !!}</p>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
9
resources/modules/stubs/views/index.stub
Normal file
9
resources/modules/stubs/views/index.stub
Normal file
@ -0,0 +1,9 @@
|
||||
@extends('$LOWER_NAME$::layouts.frontend')
|
||||
|
||||
@section('content')
|
||||
<h1>Hello World</h1>
|
||||
|
||||
<p>
|
||||
This view is loaded from module: {!! config('$LOWER_NAME$.name') !!}
|
||||
</p>
|
||||
@endsection
|
Loading…
Reference in New Issue
Block a user