v2 first commit

This commit is contained in:
denisdulici
2019-11-16 10:21:14 +03:00
parent 5b23e9c2c4
commit 6d50fa8442
3075 changed files with 3451681 additions and 65594 deletions

View File

@ -37,7 +37,7 @@ class $CLASS$ extends Command
*
* @return mixed
*/
public function fire()
public function handle()
{
//
}

View File

@ -11,5 +11,15 @@
"psr-4": {
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\": ""
}
},
"extra": {
"laravel": {
"providers": [
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\Main"
],
"aliases": {
}
}
}
}

View File

@ -0,0 +1,60 @@
<?php
namespace $CLASS_NAMESPACE$;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller;
class $CLASS$ extends Controller
{
/**
* Display a listing of the resource.
* @return Response
*/
public function index()
{
//
}
/**
* Store a newly created resource in storage.
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
//
}
/**
* Show the specified resource.
* @param int $id
* @return Response
*/
public function show($id)
{
//
}
/**
* Update the specified resource in storage.
* @param Request $request
* @param int $id
* @return Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
* @param int $id
* @return Response
*/
public function destroy($id)
{
//
}
}

View File

@ -14,7 +14,7 @@ class $CLASS$ extends Controller
*/
public function index()
{
return view('$LOWER_NAME$::index');
return view('$ALIAS$::index');
}
/**
@ -23,50 +23,57 @@ class $CLASS$ extends Controller
*/
public function create()
{
return view('$LOWER_NAME$::create');
return view('$ALIAS$::create');
}
/**
* Store a newly created resource in storage.
* @param Request $request
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
//
}
/**
* Show the specified resource.
* @param int $id
* @return Response
*/
public function show()
public function show($id)
{
return view('$LOWER_NAME$::show');
return view('$ALIAS$::show');
}
/**
* Show the form for editing the specified resource.
* @param int $id
* @return Response
*/
public function edit()
public function edit($id)
{
return view('$LOWER_NAME$::edit');
return view('$ALIAS$::edit');
}
/**
* Update the specified resource in storage.
* @param Request $request
* @param Request $request
* @param int $id
* @return Response
*/
public function update(Request $request)
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
* @param int $id
* @return Response
*/
public function destroy()
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,9 @@
<?php
use Faker\Generator as Faker;
$factory->define(Model::class, function (Faker $faker) {
return [
//
];
});

View 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()
{
//
}
}

View File

@ -2,14 +2,12 @@
namespace $NAMESPACE$;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Bus\Queueable;
use Illuminate\Foundation\Bus\Dispatchable;
class $CLASS$ implements ShouldQueue
{
use InteractsWithQueue, SerializesModels, Queueable;
use Dispatchable, Queueable;
/**
* Create a new job instance.

View File

@ -1,19 +1,14 @@
{
"name": "$STUDLY_NAME$",
"alias": "$LOWER_NAME$",
"description": "",
"alias": "$ALIAS$",
"version": "1.0.0",
"category": "payment-gateway",
"keywords": [],
"category": "accounting",
"active": 1,
"order": 0,
"providers": [
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\$STUDLY_NAME$ServiceProvider"
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\Main"
],
"aliases": {},
"files": [
"start.php"
],
"files": [],
"requires": [],
"settings": []
}

View File

@ -0,0 +1,8 @@
<?php
return [
'name' => '$STUDLY_NAME$',
'description' => 'This is my awesome module',
];

View 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)
{
//
}
}

View 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)
{
//
}
}

View 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)
{
//
}
}

View File

@ -21,10 +21,10 @@ class $CLASS$
/**
* Handle the event.
*
* @param \$EVENTNAME$ $event
* @param $SHORTEVENTNAME$ $event
* @return void
*/
public function handle(\$EVENTNAME$ $event)
public function handle($SHORTEVENTNAME$ $event)
{
//
}

View File

@ -14,7 +14,7 @@ class $CLASS$ extends Migration
public function up()
{
Schema::create('$TABLE$', function (Blueprint $table) {
$table->increments('id');
$table->bigIncrements('id');
$FIELDS$
$table->timestamps();
});

View File

@ -24,7 +24,7 @@ class $CLASS$ extends Migration
public function down()
{
Schema::create('$TABLE$', function (Blueprint $table) {
$table->increments('id');
$table->bigIncrements('id');
$FIELDS$
$table->timestamps();
});

View File

@ -0,0 +1,17 @@
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"cross-env": "^5.1.4",
"laravel-mix": "^4.0.7",
"laravel-mix-merge-manifest": "^0.1.2"
}
}

View 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()
{
//
}
}

View File

@ -6,13 +6,6 @@ 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.
*

View 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);
}
}

View 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);
}
}

View File

@ -1,41 +0,0 @@
<?php
namespace $MODULE_NAMESPACE$\$MODULE$\Providers;
use Illuminate\Routing\Router;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class $NAME$ 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__ . '/Http/routes.php';
// }
}
}

View File

@ -1,6 +0,0 @@
<?php
Route::group(['middleware' => 'web', 'prefix' => '$LOWER_NAME$', 'namespace' => '$MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers'], function()
{
Route::get('/', '$STUDLY_NAME$Controller@index');
});

View File

@ -0,0 +1,10 @@
<?php
Route::group([
'middleware' => 'admin',
'namespace' => 'Modules\$STUDLY_NAME$\Http\Controllers'
], function () {
Route::prefix('$ALIAS$')->group(function() {
// Route::get('/', 'Main@index');
});
});

View File

@ -0,0 +1,10 @@
<?php
Route::group([
'prefix' => 'portal',
'middleware' => 'portal',
'namespace' => 'Modules\$STUDLY_NAME$\Http\Controllers'
], function () {
// Route::get('invoices/{invoice}/$ALIAS$', 'Main@show')->name('portal.invoices.$ALIAS$.show');
// Route::post('invoices/{invoice}/$ALIAS$/confirm', 'Main@confirm')->name('portal.invoices.$ALIAS$.confirm');
});

View 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.';
}
}

View File

@ -2,18 +2,10 @@
namespace $NAMESPACE$;
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Factory;
use Illuminate\Support\ServiceProvider as Provider;
class $CLASS$ extends ServiceProvider
class $NAME$ extends Provider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Boot the application events.
*
@ -21,10 +13,9 @@ class $CLASS$ extends ServiceProvider
*/
public function boot()
{
$this->registerTranslations();
$this->registerConfig();
$this->registerViews();
$this->registerFactories();
$this->loadTranslations();
$this->loadViews();
$this->loadMigrations();
}
/**
@ -34,68 +25,57 @@ class $CLASS$ extends ServiceProvider
*/
public function register()
{
//
$this->loadRoutes();
}
/**
* Register config.
* Load views.
*
* @return void
*/
protected function registerConfig()
public function loadViews()
{
$this->publishes([
__DIR__.'/../$PATH_CONFIG$/config.php' => config_path('$LOWER_NAME$.php'),
], 'config');
$this->mergeConfigFrom(
__DIR__.'/../$PATH_CONFIG$/config.php', '$LOWER_NAME$'
);
$this->loadViewsFrom(__DIR__ . '/../Resources/views', '$ALIAS$');
}
/**
* Register views.
* Load translations.
*
* @return void
*/
public function registerViews()
public function loadTranslations()
{
$viewPath = resource_path('views/modules/$LOWER_NAME$');
$sourcePath = __DIR__.'/../$PATH_VIEWS$';
$this->publishes([
$sourcePath => $viewPath
]);
$this->loadViewsFrom(array_merge(array_map(function ($path) {
return $path . '/modules/$LOWER_NAME$';
}, \Config::get('view.paths')), [$sourcePath]), '$LOWER_NAME$');
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', '$ALIAS$');
}
/**
* Register translations.
* Load migrations.
*
* @return void
*/
public function registerTranslations()
public function loadMigrations()
{
$langPath = resource_path('lang/modules/$LOWER_NAME$');
$this->loadMigrationsFrom(__DIR__ . '/../$MIGRATIONS_PATH$');
}
if (is_dir($langPath)) {
$this->loadTranslationsFrom($langPath, '$LOWER_NAME$');
} else {
$this->loadTranslationsFrom(__DIR__ .'/../$PATH_LANG$', '$LOWER_NAME$');
/**
* Load routes.
*
* @return void
*/
public function loadRoutes()
{
if (app()->routesAreCached()) {
return;
}
}
/**
* 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');
$routes = [
'admin.php',
'portal.php',
];
foreach ($routes as $route) {
$this->loadRoutesFrom(__DIR__ . '/../$ROUTES_PATH$/' . $route);
}
}

View File

@ -1,6 +1,6 @@
<?php
namespace $NAMESPACE$\Database\Seeders;
namespace $NAMESPACE$;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;

View File

@ -1,17 +0,0 @@
<?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__ . '/Http/routes.php';
}

View 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);
}
}

View File

@ -1,9 +1,9 @@
@extends('$LOWER_NAME$::layouts.master')
@extends('layouts.admin')
@section('content')
<h1>Hello World</h1>
<p>
This view is loaded from module: {!! config('$LOWER_NAME$.name') !!}
This view is loaded from module: {!! config('$ALIAS$.name') !!}
</p>
@stop

View File

@ -1,12 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Module $STUDLY_NAME$</title>
</head>
<body>
@yield('content')
</body>
</html>

View File

@ -0,0 +1,14 @@
const mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.js('Resources/assets/js/$ALIAS$.js', 'Assets/js/');