new deployer command
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
return [
|
||||
'name' => 'M3',
|
||||
'features' =>
|
||||
[
|
||||
],
|
||||
'features' => [
|
||||
],
|
||||
];
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Modules\M3\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class M3DatabaseSeeder extends Seeder
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Modules\M3\Support\ModuleInfo;
|
||||
|
||||
if (! function_exists('m3_feature_enabled')) {
|
||||
@@ -7,6 +8,6 @@ if (! function_exists('m3_feature_enabled')) {
|
||||
*/
|
||||
function m3_feature_enabled(string $key): bool
|
||||
{
|
||||
return (bool) config(ModuleInfo::nameLower().".features.{$key}", false);
|
||||
return (bool) config(ModuleInfo::nameLower() . ".features.{$key}", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ class M3Controller extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index()
|
||||
@@ -19,6 +20,7 @@ class M3Controller extends Controller
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return Renderable
|
||||
*/
|
||||
public function create()
|
||||
@@ -28,7 +30,9 @@ class M3Controller extends Controller
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Renderable
|
||||
*/
|
||||
public function store(Request $request)
|
||||
@@ -38,7 +42,9 @@ class M3Controller extends Controller
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Renderable
|
||||
*/
|
||||
public function show($id)
|
||||
@@ -48,7 +54,9 @@ class M3Controller extends Controller
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Renderable
|
||||
*/
|
||||
public function edit($id)
|
||||
@@ -58,8 +66,10 @@ class M3Controller extends Controller
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @param int $id
|
||||
*
|
||||
* @return Renderable
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
@@ -69,7 +79,9 @@ class M3Controller extends Controller
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Renderable
|
||||
*/
|
||||
public function destroy($id)
|
||||
|
||||
@@ -2,31 +2,29 @@
|
||||
|
||||
namespace Modules\M3\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Database\Eloquent\Factory;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Modules\M3\Support\ModuleInfo;
|
||||
use Config;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\M3\Support\ModuleInfo;
|
||||
|
||||
class M3ServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* @var string $moduleName
|
||||
* @var string
|
||||
*/
|
||||
protected string $moduleName = 'M3';
|
||||
|
||||
/**
|
||||
* @var string $moduleNameLower
|
||||
* @var string
|
||||
*/
|
||||
protected string $moduleNameLower = 'm3';
|
||||
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides():array
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
@@ -36,7 +34,7 @@ class M3ServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot() : void
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
@@ -63,34 +61,35 @@ class M3ServiceProvider extends ServiceProvider
|
||||
*/
|
||||
protected function registerHelpers(): void
|
||||
{
|
||||
foreach (glob(__DIR__.'/../Helpers/*.php') as $filename) {
|
||||
foreach (glob(__DIR__ . '/../Helpers/*.php') as $filename) {
|
||||
require_once $filename;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Dynamically Register Commands.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerCommands(): void
|
||||
{
|
||||
if (!$this->app->runningInConsole()) {
|
||||
return;
|
||||
}
|
||||
$commandPath = __DIR__ . '/../Console';
|
||||
$commands = collect(File::allFiles($commandPath))
|
||||
->map(function ($file) {
|
||||
$class = 'Modules\\' . $this->moduleName . '\\Console\\' . $file->getFilenameWithoutExtension();
|
||||
return $class;
|
||||
})
|
||||
->filter(function ($class) {
|
||||
return class_exists($class);
|
||||
})
|
||||
->values()
|
||||
->all();
|
||||
$this->commands($commands);
|
||||
{
|
||||
if (! $this->app->runningInConsole()) {
|
||||
return;
|
||||
}
|
||||
$commandPath = __DIR__ . '/../Console';
|
||||
$commands = collect(File::allFiles($commandPath))
|
||||
->map(function ($file) {
|
||||
$class = 'Modules\\' . $this->moduleName . '\\Console\\' . $file->getFilenameWithoutExtension();
|
||||
|
||||
return $class;
|
||||
})
|
||||
->filter(function ($class) {
|
||||
return class_exists($class);
|
||||
})
|
||||
->values()
|
||||
->all();
|
||||
$this->commands($commands);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
@@ -100,10 +99,11 @@ class M3ServiceProvider extends ServiceProvider
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([
|
||||
module_path(ModuleInfo::name(), 'Config/config.php') => config_path( ModuleInfo::nameLower(). '.php'),
|
||||
module_path(ModuleInfo::name(), 'Config/config.php') => config_path(ModuleInfo::nameLower() . '.php'),
|
||||
], 'config');
|
||||
$this->mergeConfigFrom(
|
||||
module_path(ModuleInfo::name(), 'Config/config.php'), ModuleInfo::nameLower()
|
||||
module_path(ModuleInfo::name(), 'Config/config.php'),
|
||||
ModuleInfo::nameLower(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -117,9 +117,9 @@ class M3ServiceProvider extends ServiceProvider
|
||||
$viewPath = resource_path('views/modules/' . ModuleInfo::nameLower());
|
||||
$sourcePath = module_path(ModuleInfo::name(), 'Resources/views');
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath
|
||||
$sourcePath => $viewPath,
|
||||
], ['views', ModuleInfo::nameLower() . '-module-views']);
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), ModuleInfo::nameLower());
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), ModuleInfo::nameLower());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,10 +129,10 @@ class M3ServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function registerTranslations(): void
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . ModuleInfo::nameLower());
|
||||
$langPath = resource_path('lang/modules/' . ModuleInfo::nameLower());
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, ModuleInfo::nameLower());
|
||||
$this->loadTranslationsFrom($langPath, ModuleInfo::nameLower());
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path(ModuleInfo::name(), 'Resources/lang'), ModuleInfo::nameLower());
|
||||
}
|
||||
@@ -140,6 +140,7 @@ class M3ServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Regsiter View Paths
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getPublishableViewPaths(): array
|
||||
@@ -150,6 +151,7 @@ class M3ServiceProvider extends ServiceProvider
|
||||
$paths[] = $path . '/modules/' . ModuleInfo::nameLower();
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Modules\M3\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
@@ -15,4 +15,4 @@ use Illuminate\Http\Request;
|
||||
|
||||
Route::middleware('auth:api')->get('/m3', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
|
|
||||
*/
|
||||
|
||||
Route::prefix('m3')->group(function() {
|
||||
Route::prefix('m3')->group(function () {
|
||||
Route::get('/', 'M3Controller@index');
|
||||
});
|
||||
|
||||
@@ -4,10 +4,11 @@ namespace Modules\M3\Support;
|
||||
|
||||
class ModuleInfo
|
||||
{
|
||||
protected static string $moduleName = 'M3';
|
||||
protected static string $moduleName = 'M3';
|
||||
|
||||
/**
|
||||
* defines the Module Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function name(): string
|
||||
@@ -17,6 +18,7 @@ class ModuleInfo
|
||||
|
||||
/**
|
||||
* define the lowercase version
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function nameLower(): string
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
return [
|
||||
'name' => 'OTM',
|
||||
'features' =>
|
||||
[
|
||||
],
|
||||
'features' => [
|
||||
],
|
||||
];
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Modules\OTM\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class OTMDatabaseSeeder extends Seeder
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
use Modules\OTM\Support\ModuleInfo;
|
||||
|
||||
if (! function_exists('otm_feature_enabled')) {
|
||||
@@ -7,6 +8,6 @@ if (! function_exists('otm_feature_enabled')) {
|
||||
*/
|
||||
function otm_feature_enabled(string $key): bool
|
||||
{
|
||||
return (bool) config(ModuleInfo::nameLower().".features.{$key}", false);
|
||||
return (bool) config(ModuleInfo::nameLower() . ".features.{$key}", false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ class OTMController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index()
|
||||
@@ -19,6 +20,7 @@ class OTMController extends Controller
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return Renderable
|
||||
*/
|
||||
public function create()
|
||||
@@ -28,7 +30,9 @@ class OTMController extends Controller
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Renderable
|
||||
*/
|
||||
public function store(Request $request)
|
||||
@@ -38,7 +42,9 @@ class OTMController extends Controller
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Renderable
|
||||
*/
|
||||
public function show($id)
|
||||
@@ -48,7 +54,9 @@ class OTMController extends Controller
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Renderable
|
||||
*/
|
||||
public function edit($id)
|
||||
@@ -58,8 +66,10 @@ class OTMController extends Controller
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @param int $id
|
||||
*
|
||||
* @return Renderable
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
@@ -69,7 +79,9 @@ class OTMController extends Controller
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return Renderable
|
||||
*/
|
||||
public function destroy($id)
|
||||
|
||||
@@ -2,31 +2,29 @@
|
||||
|
||||
namespace Modules\OTM\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Database\Eloquent\Factory;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Modules\OTM\Support\ModuleInfo;
|
||||
use Config;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\OTM\Support\ModuleInfo;
|
||||
|
||||
class OTMServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* @var string $moduleName
|
||||
* @var string
|
||||
*/
|
||||
protected string $moduleName = 'OTM';
|
||||
|
||||
/**
|
||||
* @var string $moduleNameLower
|
||||
* @var string
|
||||
*/
|
||||
protected string $moduleNameLower = 'otm';
|
||||
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides():array
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
@@ -36,7 +34,7 @@ class OTMServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot() : void
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
@@ -63,34 +61,35 @@ class OTMServiceProvider extends ServiceProvider
|
||||
*/
|
||||
protected function registerHelpers(): void
|
||||
{
|
||||
foreach (glob(__DIR__.'/../Helpers/*.php') as $filename) {
|
||||
foreach (glob(__DIR__ . '/../Helpers/*.php') as $filename) {
|
||||
require_once $filename;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Dynamically Register Commands.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerCommands(): void
|
||||
{
|
||||
if (!$this->app->runningInConsole()) {
|
||||
return;
|
||||
}
|
||||
$commandPath = __DIR__ . '/../Console';
|
||||
$commands = collect(File::allFiles($commandPath))
|
||||
->map(function ($file) {
|
||||
$class = 'Modules\\' . $this->moduleName . '\\Console\\' . $file->getFilenameWithoutExtension();
|
||||
return $class;
|
||||
})
|
||||
->filter(function ($class) {
|
||||
return class_exists($class);
|
||||
})
|
||||
->values()
|
||||
->all();
|
||||
$this->commands($commands);
|
||||
{
|
||||
if (! $this->app->runningInConsole()) {
|
||||
return;
|
||||
}
|
||||
$commandPath = __DIR__ . '/../Console';
|
||||
$commands = collect(File::allFiles($commandPath))
|
||||
->map(function ($file) {
|
||||
$class = 'Modules\\' . $this->moduleName . '\\Console\\' . $file->getFilenameWithoutExtension();
|
||||
|
||||
return $class;
|
||||
})
|
||||
->filter(function ($class) {
|
||||
return class_exists($class);
|
||||
})
|
||||
->values()
|
||||
->all();
|
||||
$this->commands($commands);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
@@ -100,10 +99,11 @@ class OTMServiceProvider extends ServiceProvider
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([
|
||||
module_path(ModuleInfo::name(), 'Config/config.php') => config_path( ModuleInfo::nameLower(). '.php'),
|
||||
module_path(ModuleInfo::name(), 'Config/config.php') => config_path(ModuleInfo::nameLower() . '.php'),
|
||||
], 'config');
|
||||
$this->mergeConfigFrom(
|
||||
module_path(ModuleInfo::name(), 'Config/config.php'), ModuleInfo::nameLower()
|
||||
module_path(ModuleInfo::name(), 'Config/config.php'),
|
||||
ModuleInfo::nameLower(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -117,9 +117,9 @@ class OTMServiceProvider extends ServiceProvider
|
||||
$viewPath = resource_path('views/modules/' . ModuleInfo::nameLower());
|
||||
$sourcePath = module_path(ModuleInfo::name(), 'Resources/views');
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath
|
||||
$sourcePath => $viewPath,
|
||||
], ['views', ModuleInfo::nameLower() . '-module-views']);
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), ModuleInfo::nameLower());
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), ModuleInfo::nameLower());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,10 +129,10 @@ class OTMServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function registerTranslations(): void
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . ModuleInfo::nameLower());
|
||||
$langPath = resource_path('lang/modules/' . ModuleInfo::nameLower());
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, ModuleInfo::nameLower());
|
||||
$this->loadTranslationsFrom($langPath, ModuleInfo::nameLower());
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path(ModuleInfo::name(), 'Resources/lang'), ModuleInfo::nameLower());
|
||||
}
|
||||
@@ -140,6 +140,7 @@ class OTMServiceProvider extends ServiceProvider
|
||||
|
||||
/**
|
||||
* Regsiter View Paths
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getPublishableViewPaths(): array
|
||||
@@ -150,6 +151,7 @@ class OTMServiceProvider extends ServiceProvider
|
||||
$paths[] = $path . '/modules/' . ModuleInfo::nameLower();
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Modules\OTM\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
@@ -15,4 +15,4 @@ use Illuminate\Http\Request;
|
||||
|
||||
Route::middleware('auth:api')->get('/otm', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
|
|
||||
*/
|
||||
|
||||
Route::prefix('otm')->group(function() {
|
||||
Route::prefix('otm')->group(function () {
|
||||
Route::get('/', 'OTMController@index');
|
||||
});
|
||||
|
||||
@@ -4,10 +4,11 @@ namespace Modules\OTM\Support;
|
||||
|
||||
class ModuleInfo
|
||||
{
|
||||
protected static string $moduleName = 'OTM';
|
||||
protected static string $moduleName = 'OTM';
|
||||
|
||||
/**
|
||||
* defines the Module Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function name(): string
|
||||
@@ -17,6 +18,7 @@ class ModuleInfo
|
||||
|
||||
/**
|
||||
* define the lowercase version
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function nameLower(): string
|
||||
|
||||
Reference in New Issue
Block a user