Installing and managing modules from admin panel (#847)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Console\Commands;
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Contracts\Command;
|
||||
use App\Services\ImporterService;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Modules\Importer\Services\ImporterService;
|
||||
|
||||
class ImportFromClassicCommand extends Command
|
||||
{
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateModulesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('modules', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->boolean('enabled')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('modules');
|
||||
}
|
||||
}
|
||||
10
app/Database/seeds/modules.yml
Normal file
10
app/Database/seeds/modules.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
- name: 'Awards'
|
||||
enabled: 1
|
||||
- name: 'Sample'
|
||||
enabled: 1
|
||||
- name: 'VMSAcars'
|
||||
enabled: 1
|
||||
- name: 'Vacentral'
|
||||
enabled: 1
|
||||
- name: 'TestModule'
|
||||
enabled: 1
|
||||
@@ -51,3 +51,6 @@
|
||||
- name: maintenance
|
||||
display_name: Maintenance
|
||||
description: Run maintenance tasks
|
||||
- name: modules
|
||||
display_name: Modules
|
||||
description: Add/Edit Modules
|
||||
|
||||
41
app/Exceptions/ModuleExistsException.php
Normal file
41
app/Exceptions/ModuleExistsException.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
class ModuleExistsException extends AbstractHttpException
|
||||
{
|
||||
private $module_name;
|
||||
|
||||
public function __construct($module_name)
|
||||
{
|
||||
$this->module_name = $module_name;
|
||||
parent::__construct(
|
||||
409,
|
||||
'Module '.$module_name.' Already Exists!'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the RFC 7807 error type (without the URL root)
|
||||
*/
|
||||
public function getErrorType(): string
|
||||
{
|
||||
return 'module-already-exists';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the detailed error string
|
||||
*/
|
||||
public function getErrorDetails(): string
|
||||
{
|
||||
return $this->getMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array with the error details, merged with the RFC7807 response
|
||||
*/
|
||||
public function getErrorMetadata(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
38
app/Exceptions/ModuleInstallationError.php
Normal file
38
app/Exceptions/ModuleInstallationError.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
class ModuleInstallationError extends AbstractHttpException
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
500,
|
||||
'Installation of Module Failed!'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the RFC 7807 error type (without the URL root)
|
||||
*/
|
||||
public function getErrorType(): string
|
||||
{
|
||||
return 'module-installation-error';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the detailed error string
|
||||
*/
|
||||
public function getErrorDetails(): string
|
||||
{
|
||||
return $this->getMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array with the error details, merged with the RFC7807 response
|
||||
*/
|
||||
public function getErrorMetadata(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
38
app/Exceptions/ModuleInvalidFileType.php
Normal file
38
app/Exceptions/ModuleInvalidFileType.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
class ModuleInvalidFileType extends AbstractHttpException
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
415,
|
||||
'The Module File Type is Invalid!'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the RFC 7807 error type (without the URL root)
|
||||
*/
|
||||
public function getErrorType(): string
|
||||
{
|
||||
return 'module-file-type-invalid';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the detailed error string
|
||||
*/
|
||||
public function getErrorDetails(): string
|
||||
{
|
||||
return $this->getMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array with the error details, merged with the RFC7807 response
|
||||
*/
|
||||
public function getErrorMetadata(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
122
app/Http/Controllers/Admin/ModulesController.php
Normal file
122
app/Http/Controllers/Admin/ModulesController.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Contracts\Controller;
|
||||
use App\Services\ModuleService;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class ModulesController extends Controller
|
||||
{
|
||||
private $moduleSvc;
|
||||
|
||||
public function __construct(ModuleService $moduleSvc)
|
||||
{
|
||||
$this->moduleSvc = $moduleSvc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the Module.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$modules = $this->moduleSvc->getAllModules();
|
||||
$new_modules = $this->moduleSvc->scan();
|
||||
return view('admin.modules.index', [
|
||||
'modules' => $modules,
|
||||
'new_modules' => $new_modules,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new Module.
|
||||
*
|
||||
* @return Application|Factory|View
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('admin.modules.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly Uploaded Module in the Storage.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Application|RedirectResponse|Redirector
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$this->moduleSvc->installModule($request->file('module_file'));
|
||||
return $this->index();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified Module.
|
||||
*
|
||||
* @param $id
|
||||
*
|
||||
* @return Application|Factory|View
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$module = $this->moduleSvc->getModule($id);
|
||||
return view('admin.modules.edit', [
|
||||
'module' => $module,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified Module in storage.
|
||||
*
|
||||
* @param $id
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Application|RedirectResponse|Redirector
|
||||
*/
|
||||
public function update($id, Request $request)
|
||||
{
|
||||
$this->moduleSvc->updateModule($id, $request->has('enabled'));
|
||||
flash()->success('Module Status Changed!');
|
||||
return redirect(route('admin.modules.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Enabling Module Present in the Modules Folder
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Application|RedirectResponse|Redirector
|
||||
*/
|
||||
public function enable(Request $request)
|
||||
{
|
||||
$this->moduleSvc->addModule($request->input('name'));
|
||||
return redirect(route('admin.modules.index'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify and Remove the specified Module from storage.
|
||||
*
|
||||
* @param mixed $id
|
||||
* @param Request $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function destroy($id, Request $request)
|
||||
{
|
||||
$delete = $this->moduleSvc->deleteModule($id, $request->all());
|
||||
if ($delete == true) {
|
||||
flash()->success('Module Deleted Successfully!');
|
||||
return redirect(route('admin.modules.index'));
|
||||
}
|
||||
flash()->error('Verification Failed!');
|
||||
return redirect(route('admin.modules.edit', $id));
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Http\Controllers;
|
||||
namespace App\Http\Controllers\System;
|
||||
|
||||
use App\Contracts\Controller;
|
||||
use App\Services\ImporterService;
|
||||
use App\Services\Installer\DatabaseService;
|
||||
use App\Services\Installer\InstallerService;
|
||||
use App\Support\Utils;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Modules\Importer\Services\ImporterService;
|
||||
|
||||
class ImporterController extends Controller
|
||||
{
|
||||
@@ -27,13 +27,11 @@ class ImporterController extends Controller
|
||||
* Show the main page for the importer; show form for the admin email
|
||||
* and the credentials for the other database
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function index(Request $request)
|
||||
public function index()
|
||||
{
|
||||
return view('importer::step1-configure');
|
||||
return view('system.importer.step1-configure');
|
||||
}
|
||||
|
||||
protected function testDb(Request $request)
|
||||
@@ -51,7 +49,7 @@ class ImporterController extends Controller
|
||||
/**
|
||||
* Check the database connection
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param Request $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -62,12 +60,12 @@ class ImporterController extends Controller
|
||||
|
||||
try {
|
||||
$this->testDb($request);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$status = 'danger';
|
||||
$message = 'Failed! '.$e->getMessage();
|
||||
}
|
||||
|
||||
return view('importer::dbtest', [
|
||||
return view('system.importer.dbtest', [
|
||||
'status' => $status,
|
||||
'message' => $message,
|
||||
]);
|
||||
@@ -76,7 +74,7 @@ class ImporterController extends Controller
|
||||
/**
|
||||
* The post from the above
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param Request $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -90,17 +88,17 @@ class ImporterController extends Controller
|
||||
|
||||
// Generate the import manifest
|
||||
$manifest = $this->importerSvc->generateImportManifest();
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
Log::error($e->getMessage());
|
||||
|
||||
// Send it to run, step1
|
||||
return view('importer::error', [
|
||||
return view('system.importer.error', [
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
|
||||
// Send it to run, step1
|
||||
return view('importer::step2-processing', [
|
||||
return view('system.importer.step2-processing', [
|
||||
'manifest' => $manifest,
|
||||
]);
|
||||
}
|
||||
@@ -111,9 +109,9 @@ class ImporterController extends Controller
|
||||
* stage=STAGE NAME
|
||||
* start=record_start
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param Request $request
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws Exception
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -136,9 +134,6 @@ class ImporterController extends Controller
|
||||
*/
|
||||
public function complete()
|
||||
{
|
||||
$installerSvc = app(InstallerService::class);
|
||||
$installerSvc->disableInstallerModules();
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Installer\Http\Controllers;
|
||||
namespace App\Http\Controllers\System;
|
||||
|
||||
use App\Contracts\Controller;
|
||||
use App\Services\AirlineService;
|
||||
use App\Services\AnalyticsService;
|
||||
use App\Services\Installer\ConfigService;
|
||||
use App\Services\Installer\DatabaseService;
|
||||
use App\Services\Installer\InstallerService;
|
||||
use App\Services\Installer\MigrationService;
|
||||
use App\Services\Installer\RequirementsService;
|
||||
use App\Services\Installer\SeederService;
|
||||
use App\Services\UserService;
|
||||
use App\Support\Countries;
|
||||
use App\Support\Utils;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\View\View;
|
||||
use function in_array;
|
||||
use Laracasts\Flash\Flash;
|
||||
use Modules\Installer\Services\ConfigService;
|
||||
use Modules\Installer\Services\RequirementsService;
|
||||
use RuntimeException;
|
||||
|
||||
class InstallerController extends Controller
|
||||
{
|
||||
@@ -72,10 +79,10 @@ class InstallerController extends Controller
|
||||
public function index()
|
||||
{
|
||||
if (config('app.key') !== 'base64:zdgcDqu9PM8uGWCtMxd74ZqdGJIrnw812oRMmwDF6KY=') {
|
||||
return view('installer::errors/already-installed');
|
||||
return view('system.installer.errors.already-installed');
|
||||
}
|
||||
|
||||
return view('installer::install/index-start');
|
||||
return view('system.installer.install.index-start');
|
||||
}
|
||||
|
||||
protected function testDb(Request $request)
|
||||
@@ -92,6 +99,10 @@ class InstallerController extends Controller
|
||||
|
||||
/**
|
||||
* Check the database connection
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Application|Factory|View
|
||||
*/
|
||||
public function dbtest(Request $request)
|
||||
{
|
||||
@@ -100,12 +111,12 @@ class InstallerController extends Controller
|
||||
|
||||
try {
|
||||
$this->testDb($request);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$status = 'danger';
|
||||
$message = 'Failed! '.$e->getMessage();
|
||||
}
|
||||
|
||||
return view('installer::install/dbtest', [
|
||||
return view('system.installer.install.dbtest', [
|
||||
'status' => $status,
|
||||
'message' => $message,
|
||||
]);
|
||||
@@ -132,11 +143,9 @@ class InstallerController extends Controller
|
||||
/**
|
||||
* Step 1. Check the modules and permissions
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function step1(Request $request)
|
||||
public function step1()
|
||||
{
|
||||
$php_version = $this->reqSvc->checkPHPVersion();
|
||||
$extensions = $this->reqSvc->checkExtensions();
|
||||
@@ -150,9 +159,9 @@ class InstallerController extends Controller
|
||||
];
|
||||
|
||||
// Make sure there are no false values
|
||||
$passed = !\in_array(false, $statuses, true);
|
||||
$passed = !in_array(false, $statuses, true);
|
||||
|
||||
return view('installer::install/steps/step1-requirements', [
|
||||
return view('system.installer.install.steps.step1-requirements', [
|
||||
'php' => $php_version,
|
||||
'extensions' => $extensions,
|
||||
'directories' => $directories,
|
||||
@@ -163,14 +172,12 @@ class InstallerController extends Controller
|
||||
/**
|
||||
* Step 2. Database Setup
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function step2(Request $request)
|
||||
public function step2()
|
||||
{
|
||||
$db_types = ['mysql' => 'mysql', 'sqlite' => 'sqlite'];
|
||||
return view('installer::install/steps/step2-db', [
|
||||
return view('system.installer.install.steps.step2-db', [
|
||||
'db_types' => $db_types,
|
||||
]);
|
||||
}
|
||||
@@ -180,7 +187,7 @@ class InstallerController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
* @return RedirectResponse|Redirector
|
||||
*/
|
||||
public function envsetup(Request $request)
|
||||
{
|
||||
@@ -192,7 +199,7 @@ class InstallerController extends Controller
|
||||
// Before writing out the env file, test the DB credentials
|
||||
try {
|
||||
$this->testDb($request);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
Log::error('Testing db before writing configs failed');
|
||||
Log::error($e->getMessage());
|
||||
|
||||
@@ -220,7 +227,7 @@ class InstallerController extends Controller
|
||||
*/
|
||||
try {
|
||||
$this->envSvc->createConfigFiles($attrs);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
Log::error('Config files failed to write');
|
||||
Log::error($e->getMessage());
|
||||
|
||||
@@ -236,11 +243,9 @@ class InstallerController extends Controller
|
||||
/**
|
||||
* Step 2b. Setup the database
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function dbsetup(Request $request)
|
||||
public function dbsetup()
|
||||
{
|
||||
$console_out = '';
|
||||
|
||||
@@ -250,7 +255,7 @@ class InstallerController extends Controller
|
||||
$this->seederSvc->syncAllSeeds();
|
||||
} catch (QueryException $e) {
|
||||
Log::error('Error on db setup: '.$e->getMessage());
|
||||
dd($e);
|
||||
//dd($e);
|
||||
$this->envSvc->removeConfigFiles();
|
||||
Flash::error($e->getMessage());
|
||||
return redirect(route('installer.step2'))->withInput();
|
||||
@@ -258,7 +263,7 @@ class InstallerController extends Controller
|
||||
|
||||
$console_out = trim($console_out);
|
||||
|
||||
return view('installer::install/steps/step2a-db_output', [
|
||||
return view('system.installer.install.steps.step2a-db_output', [
|
||||
'console_output' => $console_out,
|
||||
]);
|
||||
}
|
||||
@@ -266,9 +271,9 @@ class InstallerController extends Controller
|
||||
/**
|
||||
* Step 3. Setup the admin user and initial settings
|
||||
*/
|
||||
public function step3(Request $request)
|
||||
public function step3()
|
||||
{
|
||||
return view('installer::install/steps/step3-user', [
|
||||
return view('system.installer.install.steps.step3-user', [
|
||||
'countries' => Countries::getSelectList(),
|
||||
]);
|
||||
}
|
||||
@@ -278,9 +283,8 @@ class InstallerController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @throws \RuntimeException
|
||||
* @throws \Prettus\Validator\Exceptions\ValidatorException
|
||||
* @throws \Exception
|
||||
* @throws RuntimeException
|
||||
* @throws Exception
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -337,21 +341,16 @@ class InstallerController extends Controller
|
||||
// Try sending telemetry info
|
||||
$this->analyticsSvc->sendInstall();
|
||||
|
||||
return view('installer::install/steps/step3a-completed', []);
|
||||
return view('system.installer.install.steps.step3a-completed', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Final step
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
* @return RedirectResponse|Redirector
|
||||
*/
|
||||
public function complete(Request $request)
|
||||
public function complete()
|
||||
{
|
||||
$installerSvc = app(InstallerService::class);
|
||||
$installerSvc->disableInstallerModules();
|
||||
|
||||
return redirect('/login');
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Updater\Http\Controllers;
|
||||
namespace App\Http\Controllers\System;
|
||||
|
||||
use App\Contracts\Controller;
|
||||
use App\Repositories\KvpRepository;
|
||||
@@ -10,8 +10,10 @@ use App\Services\Installer\MigrationService;
|
||||
use App\Services\Installer\SeederService;
|
||||
use Codedge\Updater\UpdaterManager;
|
||||
use function count;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class UpdateController extends Controller
|
||||
{
|
||||
@@ -51,18 +53,16 @@ class UpdateController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('updater::index-start');
|
||||
return view('system.updater.index-start');
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 1. Check if there's an update available. Check if there
|
||||
* are any unrun migrations
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function step1(Request $request)
|
||||
public function step1()
|
||||
{
|
||||
$this->installerSvc->clearCaches();
|
||||
|
||||
@@ -70,7 +70,7 @@ class UpdateController extends Controller
|
||||
Log::info('Upgrade is pending');
|
||||
}
|
||||
|
||||
return view('updater::steps/step1-update-available');
|
||||
return view('system.updater.steps.step1-update-available');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,13 +87,13 @@ class UpdateController extends Controller
|
||||
$migrations = $this->migrationSvc->migrationsAvailable();
|
||||
if (count($migrations) === 0) {
|
||||
$this->seederSvc->syncAllSeeds();
|
||||
return view('updater::steps/step3-update-complete');
|
||||
return view('system.updater.steps.step3-update-complete');
|
||||
}
|
||||
|
||||
$output = $this->migrationSvc->runAllMigrations();
|
||||
$this->seederSvc->syncAllSeeds();
|
||||
|
||||
return view('updater::steps/step2-migrations-done', [
|
||||
return view('system.updater.steps.step2-migrations-done', [
|
||||
'console_output' => $output,
|
||||
]);
|
||||
}
|
||||
@@ -101,11 +101,9 @@ class UpdateController extends Controller
|
||||
/**
|
||||
* Final step
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function complete(Request $request)
|
||||
public function complete()
|
||||
{
|
||||
return redirect('/login');
|
||||
}
|
||||
@@ -113,15 +111,13 @@ class UpdateController extends Controller
|
||||
/**
|
||||
* Show the update page with the latest version
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function updater(Request $request)
|
||||
public function updater()
|
||||
{
|
||||
$version = $this->kvpRepo->get('latest_version_tag');
|
||||
|
||||
return view('updater::downloader/downloader', [
|
||||
return view('system.updater.downloader/downloader', [
|
||||
'version' => $version,
|
||||
]);
|
||||
}
|
||||
@@ -129,15 +125,13 @@ class UpdateController extends Controller
|
||||
/**
|
||||
* Download the actual update and then forward the user to the updater page
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function update_download(Request $request)
|
||||
public function update_download()
|
||||
{
|
||||
$version = $this->kvpRepo->get('latest_version_tag');
|
||||
if (empty($version)) {
|
||||
return view('updater::steps/step1-no-update');
|
||||
return view('system.updater.steps.step1-no-update');
|
||||
}
|
||||
|
||||
$release = $this->updateManager->source('github')->fetch($version);
|
||||
28
app/Models/Module.php
Normal file
28
app/Models/Module.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Contracts\Model;
|
||||
|
||||
/**
|
||||
* Class ModuleManager
|
||||
*/
|
||||
class Module extends Model
|
||||
{
|
||||
public $table = 'modules';
|
||||
|
||||
public $fillable = [
|
||||
'name',
|
||||
'enabled',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'enabled' => 'boolean',
|
||||
];
|
||||
|
||||
public static $rules = [
|
||||
'name' => 'required',
|
||||
];
|
||||
}
|
||||
@@ -27,6 +27,74 @@ class RouteServiceProvider extends ServiceProvider
|
||||
$this->mapWebRoutes();
|
||||
$this->mapAdminRoutes();
|
||||
$this->mapApiRoutes();
|
||||
$this->mapImporterRoutes();
|
||||
$this->mapInstallerRoutes();
|
||||
$this->mapUpdaterRoutes();
|
||||
}
|
||||
|
||||
private function mapImporterRoutes()
|
||||
{
|
||||
Route::group([
|
||||
'as' => 'importer.',
|
||||
'prefix' => 'importer',
|
||||
'middleware' => ['web'],
|
||||
'namespace' => 'App\Http\Controllers\System',
|
||||
], function () {
|
||||
Route::get('/', 'ImporterController@index')->name('index');
|
||||
Route::post('/config', 'ImporterController@config')->name('config');
|
||||
Route::post('/dbtest', 'ImporterController@dbtest')->name('dbtest');
|
||||
|
||||
// Run the actual importer process. Additional middleware
|
||||
Route::post('/run', 'ImporterController@run')->middleware('api')->name('run');
|
||||
Route::post('/complete', 'ImporterController@complete')->name('complete');
|
||||
});
|
||||
}
|
||||
|
||||
private function mapInstallerRoutes()
|
||||
{
|
||||
Route::group([
|
||||
'as' => 'installer.',
|
||||
'prefix' => 'install',
|
||||
'middleware' => ['web'],
|
||||
'namespace' => 'App\Http\Controllers\System',
|
||||
], function () {
|
||||
Route::get('/', 'InstallerController@index')->name('index');
|
||||
Route::post('/dbtest', 'InstallerController@dbtest')->name('dbtest');
|
||||
|
||||
Route::get('/step1', 'InstallerController@step1')->name('step1');
|
||||
Route::post('/step1', 'InstallerController@step1')->name('step1post');
|
||||
|
||||
Route::get('/step2', 'InstallerController@step2')->name('step2');
|
||||
Route::post('/envsetup', 'InstallerController@envsetup')->name('envsetup');
|
||||
Route::get('/dbsetup', 'InstallerController@dbsetup')->name('dbsetup');
|
||||
|
||||
Route::get('/step3', 'InstallerController@step3')->name('step3');
|
||||
Route::post('/usersetup', 'InstallerController@usersetup')->name('usersetup');
|
||||
|
||||
Route::get('/complete', 'InstallerController@complete')->name('complete');
|
||||
});
|
||||
}
|
||||
|
||||
protected function mapUpdaterRoutes()
|
||||
{
|
||||
Route::group([
|
||||
'as' => 'update.',
|
||||
'prefix' => 'update',
|
||||
'middleware' => ['web', 'auth', 'ability:admin,admin-access'],
|
||||
'namespace' => 'App\Http\Controllers\System',
|
||||
], function () {
|
||||
Route::get('/', 'UpdateController@index')->name('index');
|
||||
|
||||
Route::get('/step1', 'UpdateController@step1')->name('step1');
|
||||
Route::post('/step1', 'UpdateController@step1')->name('step1post');
|
||||
|
||||
Route::post('/run-migrations', 'UpdateController@run_migrations')->name('run_migrations');
|
||||
Route::get('/complete', 'UpdateController@complete')->name('complete');
|
||||
|
||||
// Routes for the update downloader
|
||||
Route::get('/downloader', 'UpdateController@updater')->name('updater');
|
||||
Route::post('/downloader', 'UpdateController@update_download')->name('update_download');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,7 +109,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||
Route::group([
|
||||
'middleware' => ['web'],
|
||||
'namespace' => $this->namespace,
|
||||
], function ($router) {
|
||||
], function () {
|
||||
Route::group([
|
||||
'namespace' => 'Frontend',
|
||||
'prefix' => '',
|
||||
@@ -385,6 +453,35 @@ class RouteServiceProvider extends ServiceProvider
|
||||
'delete',
|
||||
], 'dashboard/news', ['uses' => 'DashboardController@news'])
|
||||
->name('dashboard.news')->middleware('update_pending', 'ability:admin,admin-access');
|
||||
|
||||
//Modules
|
||||
Route::group([
|
||||
'as' => 'modules.',
|
||||
'prefix' => 'modules',
|
||||
'middleware' => ['ability:admin, modules'],
|
||||
], function () {
|
||||
|
||||
//Modules Index
|
||||
Route::get('/', 'ModulesController@index')->name('index');
|
||||
|
||||
//Add Module
|
||||
Route::get('/create', 'ModulesController@create')->name('create');
|
||||
|
||||
//Store Module
|
||||
Route::post('/create', 'ModulesController@store')->name('store');
|
||||
|
||||
//Enable Module
|
||||
Route::post('/enable', 'ModulesController@enable')->name('enable');
|
||||
|
||||
//Edit Module
|
||||
Route::get('/{id}/edit', 'ModulesController@edit')->name('edit');
|
||||
|
||||
//Update Module
|
||||
Route::post('/{id}', 'ModulesController@update')->name('update');
|
||||
|
||||
//Delete Module
|
||||
Route::delete('/{id}', 'ModulesController@destroy')->name('destroy');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -402,7 +499,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||
'namespace' => $this->namespace.'\\Api',
|
||||
'prefix' => 'api',
|
||||
'as' => 'api.',
|
||||
], function ($router) {
|
||||
], function () {
|
||||
Route::group([], function () {
|
||||
Route::get('acars', 'AcarsController@live_flights');
|
||||
Route::get('acars/geojson', 'AcarsController@pireps_geojson');
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Services;
|
||||
namespace App\Services;
|
||||
|
||||
use App\Contracts\Service;
|
||||
use App\Repositories\KvpRepository;
|
||||
use App\Services\Importers\AircraftImporter;
|
||||
use App\Services\Importers\AirlineImporter;
|
||||
use App\Services\Importers\AirportImporter;
|
||||
use App\Services\Importers\ClearDatabase;
|
||||
use App\Services\Importers\ExpenseImporter;
|
||||
use App\Services\Importers\FinalizeImporter;
|
||||
use App\Services\Importers\FlightImporter;
|
||||
use App\Services\Importers\GroupImporter;
|
||||
use App\Services\Importers\LedgerImporter;
|
||||
use App\Services\Importers\PirepImporter;
|
||||
use App\Services\Importers\RankImport;
|
||||
use App\Services\Importers\SettingsImporter;
|
||||
use App\Services\Importers\UserImport;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Modules\Importer\Services\Importers\AircraftImporter;
|
||||
use Modules\Importer\Services\Importers\AirlineImporter;
|
||||
use Modules\Importer\Services\Importers\AirportImporter;
|
||||
use Modules\Importer\Services\Importers\ClearDatabase;
|
||||
use Modules\Importer\Services\Importers\ExpenseImporter;
|
||||
use Modules\Importer\Services\Importers\FinalizeImporter;
|
||||
use Modules\Importer\Services\Importers\FlightImporter;
|
||||
use Modules\Importer\Services\Importers\GroupImporter;
|
||||
use Modules\Importer\Services\Importers\LedgerImporter;
|
||||
use Modules\Importer\Services\Importers\PirepImporter;
|
||||
use Modules\Importer\Services\Importers\RankImport;
|
||||
use Modules\Importer\Services\Importers\SettingsImporter;
|
||||
use Modules\Importer\Services\Importers\UserImport;
|
||||
|
||||
class ImporterService extends Service
|
||||
{
|
||||
@@ -110,7 +110,7 @@ class ImporterService extends Service
|
||||
$manifest = [];
|
||||
|
||||
foreach ($this->importList as $importerKlass) {
|
||||
/** @var \Modules\Importer\Services\BaseImporter $importer */
|
||||
/** @var BaseImporter $importer */
|
||||
$importer = new $importerKlass();
|
||||
$manifest = array_merge($manifest, $importer->getManifest());
|
||||
}
|
||||
@@ -130,11 +130,11 @@ class ImporterService extends Service
|
||||
*/
|
||||
public function run($importer, $start = 0)
|
||||
{
|
||||
if (!in_array($importer, $this->importList)) {
|
||||
if (!in_array($importer, $this->importList, true)) {
|
||||
throw new Exception('Unknown importer "'.$importer.'"');
|
||||
}
|
||||
|
||||
/** @var $importerInst \Modules\Importer\Services\BaseImporter */
|
||||
/** @var $importerInst BaseImporter */
|
||||
$importerInst = new $importer();
|
||||
|
||||
try {
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Services\Importers;
|
||||
namespace App\Services\Importers;
|
||||
|
||||
use App\Models\Aircraft;
|
||||
use App\Models\Airline;
|
||||
use App\Models\Subfleet;
|
||||
use Modules\Importer\Services\BaseImporter;
|
||||
|
||||
class AircraftImporter extends BaseImporter
|
||||
{
|
||||
@@ -26,11 +25,11 @@ class AircraftImporter extends BaseImporter
|
||||
|
||||
// See if there is an airline column
|
||||
$columns = $this->db->getColumns($this->table);
|
||||
if (in_array('airline', $columns)) {
|
||||
if (in_array('airline', $columns, true)) {
|
||||
$fields[] = 'airline';
|
||||
}
|
||||
|
||||
if (in_array('location', $columns)) {
|
||||
if (in_array('location', $columns, true)) {
|
||||
$fields[] = 'location';
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Services\Importers;
|
||||
namespace App\Services\Importers;
|
||||
|
||||
use App\Models\Airline;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Modules\Importer\Services\BaseImporter;
|
||||
|
||||
class AirlineImporter extends BaseImporter
|
||||
{
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Services\Importers;
|
||||
namespace App\Services\Importers;
|
||||
|
||||
use App\Models\Airport;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Modules\Importer\Services\BaseImporter;
|
||||
|
||||
class AirportImporter extends BaseImporter
|
||||
{
|
||||
@@ -59,5 +58,6 @@ class AirportImporter extends BaseImporter
|
||||
}
|
||||
|
||||
$this->info('Imported '.$count.' airports');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Services;
|
||||
namespace App\Services\Importers;
|
||||
|
||||
use App\Services\ImporterService;
|
||||
use App\Services\Installer\LoggerTrait;
|
||||
use App\Utils\IdMapper;
|
||||
use App\Utils\ImporterDB;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Modules\Importer\Utils\IdMapper;
|
||||
use Modules\Importer\Utils\ImporterDB;
|
||||
|
||||
abstract class BaseImporter
|
||||
{
|
||||
@@ -20,7 +21,7 @@ abstract class BaseImporter
|
||||
/**
|
||||
* Holds the connection to the legacy database
|
||||
*
|
||||
* @var \Modules\Importer\Utils\ImporterDB
|
||||
* @var ImporterDB
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
@@ -109,6 +110,7 @@ abstract class BaseImporter
|
||||
*/
|
||||
public function getColumns(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,9 +120,7 @@ abstract class BaseImporter
|
||||
*/
|
||||
protected function parseDate($date)
|
||||
{
|
||||
$carbon = Carbon::parse($date);
|
||||
|
||||
return $carbon;
|
||||
return Carbon::parse($date);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Services\Importers;
|
||||
namespace App\Services\Importers;
|
||||
|
||||
use App\Models\Acars;
|
||||
use App\Models\Aircraft;
|
||||
@@ -17,12 +17,10 @@ use App\Models\JournalTransaction;
|
||||
use App\Models\Ledger;
|
||||
use App\Models\News;
|
||||
use App\Models\Pirep;
|
||||
use App\Models\Role;
|
||||
use App\Models\Subfleet;
|
||||
use App\Models\User;
|
||||
use App\Models\UserAward;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Modules\Importer\Services\BaseImporter;
|
||||
|
||||
class ClearDatabase extends BaseImporter
|
||||
{
|
||||
@@ -1,10 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Services\Importers;
|
||||
namespace App\Services\Importers;
|
||||
|
||||
use App\Models\Enums\ExpenseType;
|
||||
use App\Models\Expense;
|
||||
use Modules\Importer\Services\BaseImporter;
|
||||
|
||||
class ExpenseImporter extends BaseImporter
|
||||
{
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Services\Importers;
|
||||
namespace App\Services\Importers;
|
||||
|
||||
use App\Models\Airline;
|
||||
use App\Models\Expense;
|
||||
use App\Services\FinanceService;
|
||||
use App\Support\Money;
|
||||
use Modules\Importer\Services\BaseImporter;
|
||||
use Prettus\Validator\Exceptions\ValidatorException;
|
||||
|
||||
class ExpenseLogImporter extends BaseImporter
|
||||
{
|
||||
@@ -15,7 +15,7 @@ class ExpenseLogImporter extends BaseImporter
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @throws \Prettus\Validator\Exceptions\ValidatorException
|
||||
* @throws ValidatorException
|
||||
*/
|
||||
public function run($start = 0)
|
||||
{
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Services\Importers;
|
||||
namespace App\Services\Importers;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Services\AircraftService;
|
||||
use App\Services\UserService;
|
||||
use Modules\Importer\Services\BaseImporter;
|
||||
|
||||
class FinalizeImporter extends BaseImporter
|
||||
{
|
||||
@@ -1,9 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Services\Importers;
|
||||
namespace App\Services\Importers;
|
||||
|
||||
use App\Models\Flight;
|
||||
use Modules\Importer\Services\BaseImporter;
|
||||
|
||||
class FlightImporter extends BaseImporter
|
||||
{
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Services\Importers;
|
||||
namespace App\Services\Importers;
|
||||
|
||||
use App\Models\Permission;
|
||||
use App\Models\Role;
|
||||
use App\Services\RoleService;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Modules\Importer\Services\BaseImporter;
|
||||
|
||||
/**
|
||||
* Imports the groups into the permissions feature(s)
|
||||
@@ -115,7 +114,7 @@ class GroupImporter extends BaseImporter
|
||||
$permName = $this->legacy_to_permission[$legacy_name];
|
||||
if ($permName === 'admin') {
|
||||
foreach ($permMappings as $name => $value) {
|
||||
if (!in_array($value, $permissions)) {
|
||||
if (!in_array($value, $permissions, true)) {
|
||||
$permissions[] = $value;
|
||||
}
|
||||
}
|
||||
@@ -124,7 +123,7 @@ class GroupImporter extends BaseImporter
|
||||
}
|
||||
|
||||
$permMapId = $permMappings[$permName];
|
||||
if (!in_array($permMapId, $permissions)) {
|
||||
if (!in_array($permMapId, $permissions, true)) {
|
||||
$permissions[] = $permMapId;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
@@ -1,11 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Services\Importers;
|
||||
namespace App\Services\Importers;
|
||||
|
||||
use App\Models\Pirep;
|
||||
use App\Services\FinanceService;
|
||||
use App\Support\Money;
|
||||
use Modules\Importer\Services\BaseImporter;
|
||||
|
||||
class LedgerImporter extends BaseImporter
|
||||
{
|
||||
@@ -1,12 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Services\Importers;
|
||||
namespace App\Services\Importers;
|
||||
|
||||
use App\Models\Enums\FlightType;
|
||||
use App\Models\Enums\PirepSource;
|
||||
use App\Models\Enums\PirepState;
|
||||
use App\Models\Pirep;
|
||||
use Modules\Importer\Services\BaseImporter;
|
||||
|
||||
class PirepImporter extends BaseImporter
|
||||
{
|
||||
@@ -37,7 +36,7 @@ class PirepImporter extends BaseImporter
|
||||
|
||||
// See if there's a flightlevel column, export that if there is
|
||||
$columns = $this->db->getColumns($this->table);
|
||||
if (in_array('flightlevel', $columns)) {
|
||||
if (in_array('flightlevel', $columns, true)) {
|
||||
$fields[] = 'flightlevel';
|
||||
}
|
||||
|
||||
@@ -144,7 +143,7 @@ class PirepImporter extends BaseImporter
|
||||
];
|
||||
|
||||
$old_state = (int) $old_state;
|
||||
if (!in_array($old_state, $map)) {
|
||||
if (!in_array($old_state, $map, true)) {
|
||||
return PirepState::PENDING;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Services\Importers;
|
||||
namespace App\Services\Importers;
|
||||
|
||||
use App\Models\Rank;
|
||||
use Modules\Importer\Services\BaseImporter;
|
||||
|
||||
class RankImport extends BaseImporter
|
||||
{
|
||||
@@ -1,9 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Services\Importers;
|
||||
namespace App\Services\Importers;
|
||||
|
||||
use App\Repositories\SettingRepository;
|
||||
use Modules\Importer\Services\BaseImporter;
|
||||
|
||||
class SettingsImporter extends BaseImporter
|
||||
{
|
||||
@@ -1,9 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Services\Importers;
|
||||
namespace App\Services\Importers;
|
||||
|
||||
use App\Models\Enums\UserState;
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use App\Services\UserService;
|
||||
use App\Support\Units\Time;
|
||||
@@ -11,7 +10,6 @@ use App\Support\Utils;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
use Modules\Importer\Services\BaseImporter;
|
||||
|
||||
class UserImport extends BaseImporter
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Installer\Services;
|
||||
namespace App\Services\Installer;
|
||||
|
||||
use App\Contracts\Service;
|
||||
use Exception;
|
||||
@@ -4,7 +4,6 @@ namespace App\Services\Installer;
|
||||
|
||||
use App\Contracts\Service;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Nwidart\Modules\Facades\Module;
|
||||
|
||||
class InstallerService extends Service
|
||||
{
|
||||
@@ -44,27 +43,6 @@ class InstallerService extends Service
|
||||
*/
|
||||
public function clearCaches(): void
|
||||
{
|
||||
$commands = [
|
||||
'clear-compiled',
|
||||
'cache:clear',
|
||||
'route:clear',
|
||||
'view:clear',
|
||||
];
|
||||
|
||||
foreach ($commands as $cmd) {
|
||||
Artisan::call($cmd);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the installer and importer modules
|
||||
*/
|
||||
public function disableInstallerModules()
|
||||
{
|
||||
$module = Module::find('installer');
|
||||
$module->disable();
|
||||
|
||||
$module = Module::find('importer');
|
||||
$module->disable();
|
||||
Artisan::call('optimize:clear');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Installer\Services;
|
||||
namespace App\Services\Installer;
|
||||
|
||||
use App\Contracts\Service;
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace App\Services\Installer;
|
||||
use App\Contracts\Service;
|
||||
use App\Models\Setting;
|
||||
use App\Services\DatabaseService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -42,6 +43,10 @@ class SeederService extends Service
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->moduleSeedsPending()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -54,6 +59,7 @@ class SeederService extends Service
|
||||
$this->syncAllYamlFileSeeds();
|
||||
$this->syncAllSettings();
|
||||
$this->syncAllPermissions();
|
||||
$this->syncAllModules();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,6 +89,24 @@ class SeederService extends Service
|
||||
});
|
||||
}
|
||||
|
||||
public function syncAllModules(): void
|
||||
{
|
||||
$data = file_get_contents(database_path('/seeds/modules.yml'));
|
||||
$yml = Yaml::parse($data);
|
||||
foreach ($yml as $module) {
|
||||
$module['updated_at'] = Carbon::now();
|
||||
$count = DB::table('modules')->where('name', $module['name'])->count('name');
|
||||
if ($count === 0) {
|
||||
$module['created_at'] = Carbon::now();
|
||||
DB::table('modules')->insert($module);
|
||||
} else {
|
||||
DB::table('modules')
|
||||
->where('name', $module['name'])
|
||||
->update($module);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function syncAllSettings(): void
|
||||
{
|
||||
$data = file_get_contents(database_path('/seeds/settings.yml'));
|
||||
@@ -286,4 +310,28 @@ class SeederService extends Service
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function moduleSeedsPending(): bool
|
||||
{
|
||||
$all_modules = DB::table('modules')->get();
|
||||
|
||||
$data = file_get_contents(database_path('/seeds/modules.yml'));
|
||||
$yml = Yaml::parse($data);
|
||||
|
||||
foreach ($yml as $perm) {
|
||||
$row = $all_modules->firstWhere('name', $perm['name']);
|
||||
if (!$row) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// See if any of these column values have changed
|
||||
foreach (['name', 'enabled'] as $column) {
|
||||
if ($row->{$column} !== $perm[$column]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Contracts\Service;
|
||||
use App\Exceptions\ModuleExistsException;
|
||||
use App\Exceptions\ModuleInstallationError;
|
||||
use App\Exceptions\ModuleInvalidFileType;
|
||||
use App\Models\Module;
|
||||
use Exception;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Laracasts\Flash\FlashNotifier;
|
||||
use Madnest\Madzipper\Madzipper;
|
||||
use Nwidart\Modules\Json;
|
||||
use PharData;
|
||||
|
||||
class ModuleService extends Service
|
||||
{
|
||||
@@ -22,14 +38,14 @@ class ModuleService extends Service
|
||||
* @param string $title
|
||||
* @param string $url
|
||||
* @param string $icon
|
||||
* @param mixed $logged_in
|
||||
* @param bool $logged_in
|
||||
*/
|
||||
public function addFrontendLink(string $title, string $url, string $icon = '', $logged_in = true)
|
||||
public function addFrontendLink(string $title, string $url, string $icon = 'pe-7s-users', $logged_in = true)
|
||||
{
|
||||
self::$frontendLinks[$logged_in][] = [
|
||||
'title' => $title,
|
||||
'url' => $url,
|
||||
'icon' => 'pe-7s-users',
|
||||
'icon' => $icon,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -52,12 +68,12 @@ class ModuleService extends Service
|
||||
* @param string $url
|
||||
* @param string $icon
|
||||
*/
|
||||
public function addAdminLink(string $title, string $url, string $icon = '')
|
||||
public function addAdminLink(string $title, string $url, string $icon = 'pe-7s-users')
|
||||
{
|
||||
self::$adminLinks[] = [
|
||||
'title' => $title,
|
||||
'url' => $url,
|
||||
'icon' => 'pe-7s-users',
|
||||
'icon' => $icon,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -70,4 +86,217 @@ class ModuleService extends Service
|
||||
{
|
||||
return self::$adminLinks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get All modules from Database
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function getAllModules(): object
|
||||
{
|
||||
return Module::all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Module Information from Database.
|
||||
*
|
||||
* @param $id
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function getModule($id): object
|
||||
{
|
||||
return Module::find($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adding installed module to the database
|
||||
*
|
||||
* @param $module_name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function addModule($module_name): bool
|
||||
{
|
||||
/*Check if module already exists*/
|
||||
$module = Module::where('name', $module_name);
|
||||
if (!$module->exists()) {
|
||||
Module::create([
|
||||
'name' => $module_name,
|
||||
'enabled' => 1,
|
||||
]);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* User's uploaded file is passed into this method
|
||||
* to install module in the Storage.
|
||||
*
|
||||
* @param UploadedFile $file
|
||||
*
|
||||
* @return FlashNotifier
|
||||
*/
|
||||
public function installModule(UploadedFile $file): FlashNotifier
|
||||
{
|
||||
$file_ext = $file->getClientOriginalExtension();
|
||||
$allowed_extensions = ['zip', 'tar', 'gz'];
|
||||
|
||||
if (!in_array($file_ext, $allowed_extensions, true)) {
|
||||
throw new ModuleInvalidFileType();
|
||||
}
|
||||
|
||||
$module = null;
|
||||
|
||||
$new_dir = rand();
|
||||
|
||||
File::makeDirectory(
|
||||
storage_path('app/tmp/modules/'.$new_dir),
|
||||
0777,
|
||||
true
|
||||
);
|
||||
$temp_ext_folder = storage_path('app/tmp/modules/'.$new_dir);
|
||||
$temp = storage_path('app/tmp/modules/'.$new_dir);
|
||||
|
||||
$zipper = null;
|
||||
|
||||
if ($file_ext === 'tar' || $file_ext === 'gz') {
|
||||
$zipper = new PharData($file);
|
||||
$zipper->decompress();
|
||||
}
|
||||
|
||||
if ($file_ext === 'zip') {
|
||||
$madZipper = new Madzipper();
|
||||
|
||||
try {
|
||||
$zipper = $madZipper->make($file);
|
||||
} catch (Exception $e) {
|
||||
throw new ModuleInstallationError();
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$zipper->extractTo($temp);
|
||||
} catch (Exception $e) {
|
||||
throw new ModuleInstallationError();
|
||||
}
|
||||
|
||||
if (!File::exists($temp.'/module.json')) {
|
||||
$directories = Storage::directories('tmp/modules/'.$new_dir);
|
||||
$temp = storage_path('app/'.$directories[0]);
|
||||
}
|
||||
|
||||
$json_file = $temp.'/module.json';
|
||||
|
||||
if (File::exists($json_file)) {
|
||||
$json = json_decode(file_get_contents($json_file), true);
|
||||
$module = $json['name'];
|
||||
} else {
|
||||
File::deleteDirectory($temp_ext_folder);
|
||||
return flash()->error('Module Structure Not Correct!');
|
||||
}
|
||||
|
||||
if (!$module) {
|
||||
File::deleteDirectory($temp_ext_folder);
|
||||
return flash()->error('Not a Valid Module File.');
|
||||
}
|
||||
|
||||
$toCopy = base_path().'/modules/'.$module;
|
||||
|
||||
if (File::exists($toCopy)) {
|
||||
File::deleteDirectory($temp_ext_folder);
|
||||
|
||||
throw new ModuleExistsException($module);
|
||||
}
|
||||
|
||||
File::moveDirectory($temp, $toCopy);
|
||||
|
||||
File::deleteDirectory($temp_ext_folder);
|
||||
|
||||
try {
|
||||
$this->addModule($module);
|
||||
} catch (Exception $e) {
|
||||
throw new ModuleExistsException($module);
|
||||
}
|
||||
|
||||
Artisan::call('config:cache');
|
||||
Artisan::call('module:migrate '.$module);
|
||||
|
||||
return flash()->success('Module Installed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update module with the status passed by user.
|
||||
*
|
||||
* @param $id
|
||||
* @param $status
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function updateModule($id, $status): bool
|
||||
{
|
||||
$module = Module::find($id);
|
||||
$module->update([
|
||||
'enabled' => $status,
|
||||
]);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Module from the Storage & Database.
|
||||
*
|
||||
* @param $id
|
||||
* @param $data
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteModule($id, $data): bool
|
||||
{
|
||||
$module = Module::find($id);
|
||||
if ($data['verify'] === strtoupper($module->name)) {
|
||||
try {
|
||||
$module->delete();
|
||||
} catch (Exception $e) {
|
||||
Log::emergency('Cannot Delete Module!');
|
||||
}
|
||||
$moduleDir = base_path().'/modules/'.$module->name;
|
||||
|
||||
try {
|
||||
File::deleteDirectory($moduleDir);
|
||||
} catch (Exception $e) {
|
||||
Log::info('Folder Deleted Manually for Module : '.$module->name);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get & scan all modules.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function scan()
|
||||
{
|
||||
$modules_path = base_path('modules/*');
|
||||
$path = Str::endsWith($modules_path, '/*') ? $modules_path : Str::finish($modules_path, '/*');
|
||||
|
||||
$modules = [];
|
||||
|
||||
$manifests = (new Filesystem())->glob("{$path}/module.json");
|
||||
|
||||
is_array($manifests) || $manifests = [];
|
||||
|
||||
foreach ($manifests as $manifest) {
|
||||
$name = Json::make($manifest)->get('name');
|
||||
$module = Module::where('name', $name);
|
||||
if (!$module->exists()) {
|
||||
array_push($modules, $name);
|
||||
}
|
||||
}
|
||||
|
||||
return $modules;
|
||||
}
|
||||
}
|
||||
|
||||
153
app/Support/Modules/DatabaseActivator.php
Normal file
153
app/Support/Modules/DatabaseActivator.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
namespace App\Support\Modules;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Config\Repository as Config;
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Filesystem\Filesystem;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Nwidart\Modules\Contracts\ActivatorInterface;
|
||||
use Nwidart\Modules\Module;
|
||||
|
||||
class DatabaseActivator implements ActivatorInterface
|
||||
{
|
||||
/**
|
||||
* Laravel config instance
|
||||
*
|
||||
* @var Config
|
||||
*/
|
||||
private $config;
|
||||
|
||||
/**
|
||||
* @var Filesystem
|
||||
*/
|
||||
private $files;
|
||||
|
||||
/**
|
||||
* The module path.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $path;
|
||||
|
||||
/**
|
||||
* The scanned paths.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $paths = [];
|
||||
|
||||
/**
|
||||
* Array of modules activation statuses
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $modulesStatuses;
|
||||
|
||||
public function __construct(Container $app, $path = null)
|
||||
{
|
||||
$this->config = $app['config'];
|
||||
$this->files = $app['files'];
|
||||
$this->modulesStatuses = $this->getModulesStatuses();
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get modules statuses, from the database
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getModulesStatuses(): array
|
||||
{
|
||||
try {
|
||||
$modules = \App\Models\Module::all();
|
||||
$retVal = [];
|
||||
foreach ($modules as $i) {
|
||||
$retVal[$i->name] = $i->enabled;
|
||||
}
|
||||
return $retVal;
|
||||
} catch (Exception $e) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function reset(): void
|
||||
{
|
||||
(new \App\Models\Module())->truncate();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function enable(Module $module): void
|
||||
{
|
||||
$this->setActiveByName($module->getName(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function disable(Module $module): void
|
||||
{
|
||||
$this->setActiveByName($module->getName(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* \Nwidart\Modules\Module instance passed
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function hasStatus(Module $module, bool $status): bool
|
||||
{
|
||||
try {
|
||||
$module = (new \App\Models\Module())->where('name', $module->getName());
|
||||
if ($module->exists()) {
|
||||
return $module->first()->enabled == 1;
|
||||
}
|
||||
return false;
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setActive(Module $module, bool $active): void
|
||||
{
|
||||
$this->setActiveByName($module->getName(), $active);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setActiveByName(string $name, bool $status): void
|
||||
{
|
||||
$module = (new \App\Models\Module())->where('name', $name);
|
||||
if ($module->exists()) {
|
||||
$module->update([
|
||||
'status' => $status,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function delete(Module $module): void
|
||||
{
|
||||
$name = $module->getName();
|
||||
|
||||
try {
|
||||
(new \App\Models\Module())->where([
|
||||
'name' => $name,
|
||||
])->delete();
|
||||
} catch (Exception $e) {
|
||||
Log::error('Module '.$module.' Delete failed! Exception : '.$e->getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Updater\Lib;
|
||||
namespace App\Support;
|
||||
|
||||
use App\Services\VersionService;
|
||||
use Codedge\Updater\Contracts\GithubRepositoryTypeContract;
|
||||
use Codedge\Updater\SourceRepositoryTypes\GithubRepositoryType;
|
||||
use Codedge\Updater\Traits\SupportPrivateAccessToken;
|
||||
use Codedge\Updater\Traits\UseVersionFile;
|
||||
use Exception;
|
||||
use GuzzleHttp\Client;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
use InvalidArgumentException;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
@@ -32,6 +34,10 @@ final class VmsRepositoryType extends GithubRepositoryType implements GithubRepo
|
||||
* @var VersionService
|
||||
*/
|
||||
protected $versionSvc;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $storagePath;
|
||||
|
||||
public function __construct(array $config, Client $client)
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Utils;
|
||||
namespace App\Utils;
|
||||
|
||||
use App\Contracts\Service;
|
||||
use Spatie\Valuestore\Valuestore;
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Utils;
|
||||
namespace App\Utils;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use PDO;
|
||||
@@ -42,7 +42,7 @@
|
||||
"markrogoyski/math-php": "^0.38.0",
|
||||
"myclabs/deep-copy": "~1.9.0",
|
||||
"nabeel/vacentral": "~2.0",
|
||||
"nwidart/laravel-modules": "^7.0",
|
||||
"nwidart/laravel-modules": "^8.0",
|
||||
"php-units-of-measure/php-units-of-measure": "~2.1.0",
|
||||
"phpvms/sample-module": "^1.0",
|
||||
"pragmarx/version": "^1.2.2",
|
||||
@@ -57,7 +57,8 @@
|
||||
"vlucas/phpdotenv": "v4.0",
|
||||
"webpatser/laravel-uuid": "~3.0",
|
||||
"oomphinc/composer-installers-extender": "^1.1",
|
||||
"laravel/ui": "^2.0"
|
||||
"laravel/ui": "^2.0",
|
||||
"madnest/madzipper": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "^3.0",
|
||||
|
||||
99
composer.lock
generated
99
composer.lock
generated
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "1fa03b1b729d3f2f2dd04eba1c1749f0",
|
||||
"content-hash": "6f5fb0bd12dc789b1ad1613ddf907a80",
|
||||
"packages": [
|
||||
{
|
||||
"name": "akaunting/money",
|
||||
@@ -2925,28 +2925,28 @@
|
||||
},
|
||||
{
|
||||
"name": "laravelcollective/html",
|
||||
"version": "v6.1.2",
|
||||
"version": "v6.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/LaravelCollective/html.git",
|
||||
"reference": "5ef9a3c9ae2423fe5618996f3cde375d461a3fc6"
|
||||
"reference": "3bb99be7502feb2129b375cd026ccb0fa4b66628"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/LaravelCollective/html/zipball/5ef9a3c9ae2423fe5618996f3cde375d461a3fc6",
|
||||
"reference": "5ef9a3c9ae2423fe5618996f3cde375d461a3fc6",
|
||||
"url": "https://api.github.com/repos/LaravelCollective/html/zipball/3bb99be7502feb2129b375cd026ccb0fa4b66628",
|
||||
"reference": "3bb99be7502feb2129b375cd026ccb0fa4b66628",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/http": "^6.0|^7.0",
|
||||
"illuminate/routing": "^6.0|^7.0",
|
||||
"illuminate/session": "^6.0|^7.0",
|
||||
"illuminate/support": "^6.0|^7.0",
|
||||
"illuminate/view": "^6.0|^7.0",
|
||||
"illuminate/http": "^6.0|^7.0|^8.0",
|
||||
"illuminate/routing": "^6.0|^7.0|^8.0",
|
||||
"illuminate/session": "^6.0|^7.0|^8.0",
|
||||
"illuminate/support": "^6.0|^7.0|^8.0",
|
||||
"illuminate/view": "^6.0|^7.0|^8.0",
|
||||
"php": ">=7.2.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"illuminate/database": "^6.0|^7.0",
|
||||
"illuminate/database": "^6.0|^7.0|^8.0",
|
||||
"mockery/mockery": "~1.0",
|
||||
"phpunit/phpunit": "~7.1"
|
||||
},
|
||||
@@ -2989,7 +2989,7 @@
|
||||
],
|
||||
"description": "HTML and Form Builders for the Laravel Framework",
|
||||
"homepage": "https://laravelcollective.com",
|
||||
"time": "2020-05-19T18:02:16+00:00"
|
||||
"time": "2020-09-07T19:59:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "layershifter/tld-database",
|
||||
@@ -3575,6 +3575,63 @@
|
||||
],
|
||||
"time": "2020-08-09T10:34:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "madnest/madzipper",
|
||||
"version": "v1.0.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/madnest/madzipper.git",
|
||||
"reference": "c9ee808506a5d53e28876580f98d57717e9b80af"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/madnest/madzipper/zipball/c9ee808506a5d53e28876580f98d57717e9b80af",
|
||||
"reference": "c9ee808506a5d53e28876580f98d57717e9b80af",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-zip": "*",
|
||||
"illuminate/filesystem": "^6.18|^7.0|^8.0",
|
||||
"illuminate/support": "^6.18|^7.0|^8.0",
|
||||
"laravel/framework": "~7.0|~8.0",
|
||||
"php": ">=7.2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.3",
|
||||
"orchestra/testbench": "^5.1",
|
||||
"phpunit/phpunit": "^8.0|^9.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Madnest\\Madzipper\\MadzipperServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Madzipper": "Madnest\\Madzipper\\Madzipper"
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Madnest\\Madzipper\\": "src/Madnest/Madzipper"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jakub Theimer",
|
||||
"email": "theimer@madne.st",
|
||||
"homepage": "https://madne.st",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Wannabe successor of Chumper/Zipper package for Laravel",
|
||||
"time": "2020-09-15T11:11:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "markrogoyski/math-php",
|
||||
"version": "v0.38.0",
|
||||
@@ -3959,27 +4016,27 @@
|
||||
},
|
||||
{
|
||||
"name": "nwidart/laravel-modules",
|
||||
"version": "7.2.0",
|
||||
"version": "8.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/nWidart/laravel-modules.git",
|
||||
"reference": "8980876d63096951e067bcaf8649d591d4c7f0da"
|
||||
"reference": "7983e41c3832a13e521aa915532efdc7b67563af"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/nWidart/laravel-modules/zipball/8980876d63096951e067bcaf8649d591d4c7f0da",
|
||||
"reference": "8980876d63096951e067bcaf8649d591d4c7f0da",
|
||||
"url": "https://api.github.com/repos/nWidart/laravel-modules/zipball/7983e41c3832a13e521aa915532efdc7b67563af",
|
||||
"reference": "7983e41c3832a13e521aa915532efdc7b67563af",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"php": ">=7.2.5"
|
||||
"php": ">=7.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^2.16",
|
||||
"laravel/framework": "^7.0",
|
||||
"laravel/framework": "^8.0",
|
||||
"mockery/mockery": "~1.0",
|
||||
"orchestra/testbench": "^5.0",
|
||||
"orchestra/testbench": "^6.0",
|
||||
"phpstan/phpstan": "^0.12.14",
|
||||
"phpunit/phpunit": "^8.5",
|
||||
"spatie/phpunit-snapshot-assertions": "^2.1.0"
|
||||
@@ -3995,7 +4052,7 @@
|
||||
}
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-master": "7.0-dev"
|
||||
"dev-master": "8.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -4032,7 +4089,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-07-30T17:10:13+00:00"
|
||||
"time": "2020-10-03T14:56:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "oomphinc/composer-installers-extender",
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
* your install. Otherwise, any changes here will get overridden in an update!
|
||||
*/
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
return [
|
||||
'name' => env('APP_NAME', 'phpvms'),
|
||||
'env' => env('APP_ENV', 'dev'),
|
||||
@@ -92,7 +94,7 @@ return [
|
||||
'Auth' => Illuminate\Support\Facades\Auth::class,
|
||||
'Blade' => Illuminate\Support\Facades\Blade::class,
|
||||
'Cache' => Illuminate\Support\Facades\Cache::class,
|
||||
'Carbon' => \Carbon\Carbon::class,
|
||||
'Carbon' => Carbon::class,
|
||||
'Config' => Illuminate\Support\Facades\Config::class,
|
||||
'Cookie' => Illuminate\Support\Facades\Cookie::class,
|
||||
'Crypt' => Illuminate\Support\Facades\Crypt::class,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use App\Support\Modules\DatabaseActivator;
|
||||
use Nwidart\Modules\Activators\FileActivator;
|
||||
|
||||
return [
|
||||
@@ -11,6 +12,8 @@ return [
|
||||
'routes' => 'Http/Routes/web.php',
|
||||
'routes-api' => 'Http/Routes/api.php',
|
||||
'routes-admin' => 'Http/Routes/admin.php',
|
||||
'provider' => 'Providers/AppServiceProvider.php',
|
||||
'route-provider' => 'Providers/RouteServiceProvider.php',
|
||||
'event-service-provider' => 'Providers/EventServiceProvider.php',
|
||||
'views/index' => 'Resources/views/index.blade.php',
|
||||
'views/index-admin' => 'Resources/views/admin/index.blade.php',
|
||||
@@ -29,6 +32,7 @@ return [
|
||||
'routes-api' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'],
|
||||
'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'],
|
||||
'provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'],
|
||||
'route-provider' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'],
|
||||
'event-service-provider' => [
|
||||
'LOWER_NAME',
|
||||
'STUDLY_NAME',
|
||||
@@ -36,7 +40,7 @@ return [
|
||||
'CLASS_NAMESPACE',
|
||||
],
|
||||
'listener-test' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'],
|
||||
'views/index' => ['LOWER_NAME'],
|
||||
'views/index' => ['LOWER_NAME', 'STUDLY_NAME'],
|
||||
'views/index-admin' => ['LOWER_NAME', 'STUDLY_NAME'],
|
||||
'views/frontend' => ['STUDLY_NAME'],
|
||||
'views/admin' => ['STUDLY_NAME'],
|
||||
@@ -89,7 +93,7 @@ return [
|
||||
'filter' => ['path' => 'Http/Middleware', 'generate' => true],
|
||||
'request' => ['path' => 'Http/Requests', 'generate' => true],
|
||||
'routes' => ['path' => 'Http/Routes', 'generate' => true],
|
||||
'provider' => ['path' => 'Providers', 'generate' => true],
|
||||
'provider' => ['path' => 'Providers', 'generate' => false],
|
||||
'assets' => ['path' => 'Resources/assets', 'generate' => true],
|
||||
'lang' => ['path' => 'Resources/lang', 'generate' => true],
|
||||
'views' => ['path' => 'Resources/views', 'generate' => true],
|
||||
@@ -162,7 +166,7 @@ return [
|
||||
'translations' => true,
|
||||
],
|
||||
|
||||
'activator' => 'file',
|
||||
'activator' => 'database',
|
||||
'activators' => [
|
||||
'file' => [
|
||||
'class' => FileActivator::class,
|
||||
@@ -170,5 +174,8 @@ return [
|
||||
'cache-key' => 'activator.installed',
|
||||
'cache-lifetime' => 0,
|
||||
],
|
||||
'database' => [
|
||||
'class' => DatabaseActivator::class,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"Awards": true,
|
||||
"Importer": true,
|
||||
"Installer": true,
|
||||
"Sample": true,
|
||||
"Updater": true,
|
||||
"VMSAcars": true,
|
||||
"Vacentral": true,
|
||||
"TestModule": true
|
||||
}
|
||||
1
modules/.gitignore
vendored
1
modules/.gitignore
vendored
@@ -8,3 +8,4 @@
|
||||
!/Installer
|
||||
!/Updater
|
||||
!/Vacentral
|
||||
!/ModulesManager
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Importer\Providers;
|
||||
|
||||
use App\Contracts\Modules\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Importer\Console\Commands\ImportFromClassicCommand;
|
||||
|
||||
class ImporterServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Boot the application events.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerCommands();
|
||||
$this->registerRoutes();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register console commands
|
||||
*/
|
||||
protected function registerCommands()
|
||||
{
|
||||
$this->commands([
|
||||
ImportFromClassicCommand::class,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the routes
|
||||
*/
|
||||
protected function registerRoutes()
|
||||
{
|
||||
Route::group([
|
||||
'as' => 'importer.',
|
||||
'prefix' => 'importer',
|
||||
'middleware' => ['web'],
|
||||
'namespace' => 'Modules\Importer\Http\Controllers',
|
||||
], function () {
|
||||
Route::get('/', 'ImporterController@index')->name('index');
|
||||
Route::post('/config', 'ImporterController@config')->name('config');
|
||||
Route::post('/dbtest', 'ImporterController@dbtest')->name('dbtest');
|
||||
|
||||
// Run the actual importer process. Additional middleware
|
||||
Route::post('/run', 'ImporterController@run')->middleware('api')->name('run');
|
||||
Route::post('/complete', 'ImporterController@complete')->name('complete');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->mergeConfigFrom(__DIR__.'/../Config/config.php', 'importer');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = resource_path('views/modules/importer');
|
||||
$sourcePath = __DIR__.'/../Resources/views';
|
||||
|
||||
$this->publishes([$sourcePath => $viewPath], 'views');
|
||||
|
||||
$paths = array_map(
|
||||
function ($path) {
|
||||
return $path.'/modules/importer';
|
||||
},
|
||||
\Config::get('view.paths')
|
||||
);
|
||||
|
||||
$paths[] = $sourcePath;
|
||||
$this->loadViewsFrom($paths, 'importer');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = resource_path('lang/modules/importer');
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, 'importer');
|
||||
} else {
|
||||
$this->loadTranslationsFrom(__DIR__.'/../Resources/lang', 'importer');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"name": "phpvms/importer",
|
||||
"type": "laravel-library",
|
||||
"description": "The importer module for phpVMS",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nabeel Shahzad",
|
||||
"email": ""
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"composer/installers": "~1.0"
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Modules\\Importer\\Providers\\ImporterServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Importer\\": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"name": "Importer",
|
||||
"alias": "importer",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"active": 1,
|
||||
"order": 0,
|
||||
"providers": [
|
||||
"Modules\\Importer\\Providers\\ImporterServiceProvider"
|
||||
],
|
||||
"aliases": {},
|
||||
"files": [],
|
||||
"requires": []
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Installer\Providers;
|
||||
|
||||
use App\Contracts\Modules\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class InstallerServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Boot the application events.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerRoutes();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the routes
|
||||
*/
|
||||
protected function registerRoutes()
|
||||
{
|
||||
Route::group([
|
||||
'as' => 'installer.',
|
||||
'prefix' => 'install',
|
||||
'middleware' => ['web'],
|
||||
'namespace' => 'Modules\Installer\Http\Controllers',
|
||||
], function () {
|
||||
Route::get('/', 'InstallerController@index')->name('index');
|
||||
Route::post('/dbtest', 'InstallerController@dbtest')->name('dbtest');
|
||||
|
||||
Route::get('/step1', 'InstallerController@step1')->name('step1');
|
||||
Route::post('/step1', 'InstallerController@step1')->name('step1post');
|
||||
|
||||
Route::get('/step2', 'InstallerController@step2')->name('step2');
|
||||
Route::post('/envsetup', 'InstallerController@envsetup')->name('envsetup');
|
||||
Route::get('/dbsetup', 'InstallerController@dbsetup')->name('dbsetup');
|
||||
|
||||
Route::get('/step3', 'InstallerController@step3')->name('step3');
|
||||
Route::post('/usersetup', 'InstallerController@usersetup')->name('usersetup');
|
||||
|
||||
Route::get('/complete', 'InstallerController@complete')->name('complete');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->mergeConfigFrom(__DIR__.'/../Config/config.php', 'installer');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = resource_path('views/modules/installer');
|
||||
$sourcePath = __DIR__.'/../Resources/views';
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath,
|
||||
], 'views');
|
||||
|
||||
$paths = array_map(
|
||||
function ($path) {
|
||||
return $path.'/modules/installer';
|
||||
},
|
||||
\Config::get('view.paths')
|
||||
);
|
||||
|
||||
$paths[] = $sourcePath;
|
||||
$this->loadViewsFrom($paths, 'installer');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = resource_path('lang/modules/installer');
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, 'installer');
|
||||
} else {
|
||||
$this->loadTranslationsFrom(__DIR__.'/../Resources/lang', 'installer');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
{
|
||||
"name": "phpvms/installer",
|
||||
"license": "",
|
||||
"type": "laravel-library",
|
||||
"description": "The installer module for phpVMS",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nabeel Shahzad",
|
||||
"email": "nabeel@phpvms.net"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"composer/installers": "~1.0"
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Modules\\Installer\\Providers\\InstallerServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Installer\\": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"name": "Installer",
|
||||
"alias": "installer",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"active": 1,
|
||||
"order": 0,
|
||||
"providers": [
|
||||
"Modules\\Installer\\Providers\\InstallerServiceProvider"
|
||||
],
|
||||
"aliases": {},
|
||||
"files": [],
|
||||
"requires": []
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Updater\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class UpdateServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
$this->registerRoutes();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the routes
|
||||
*/
|
||||
protected function registerRoutes()
|
||||
{
|
||||
Route::group([
|
||||
'as' => 'update.',
|
||||
'prefix' => 'update',
|
||||
'middleware' => ['web', 'auth', 'ability:admin,admin-access'],
|
||||
'namespace' => 'Modules\Updater\Http\Controllers',
|
||||
], function () {
|
||||
Route::get('/', 'UpdateController@index')->name('index');
|
||||
|
||||
Route::get('/step1', 'UpdateController@step1')->name('step1');
|
||||
Route::post('/step1', 'UpdateController@step1')->name('step1post');
|
||||
|
||||
Route::post('/run-migrations', 'UpdateController@run_migrations')->name('run_migrations');
|
||||
Route::get('/complete', 'UpdateController@complete')->name('complete');
|
||||
|
||||
// Routes for the update downloader
|
||||
Route::get('/downloader', 'UpdateController@updater')->name('updater');
|
||||
Route::post('/downloader', 'UpdateController@update_download')->name('update_download');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->mergeConfigFrom(__DIR__.'/../Config/config.php', 'updater');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = resource_path('views/modules/updater');
|
||||
$sourcePath = __DIR__.'/../Resources/views';
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath,
|
||||
], 'views');
|
||||
|
||||
$paths = array_map(
|
||||
function ($path) {
|
||||
return $path.'/modules/updater';
|
||||
},
|
||||
\Config::get('view.paths')
|
||||
);
|
||||
|
||||
$paths[] = $sourcePath;
|
||||
$this->loadViewsFrom($paths, 'updater');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = resource_path('lang/modules/updater');
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, 'updater');
|
||||
} else {
|
||||
$this->loadTranslationsFrom(__DIR__.'/../Resources/lang', 'updater');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
{
|
||||
"name": "phpvms/updater",
|
||||
"license": "",
|
||||
"type": "laravel-library",
|
||||
"description": "The installer module for phpVMS",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nabeel Shahzad",
|
||||
"email": "nabeel@phpvms.net"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"composer/installers": "~1.0"
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Modules\\Updater\\Providers\\UpdateServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Installer\\": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"name": "Updater",
|
||||
"alias": "updater",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"active": 1,
|
||||
"order": 0,
|
||||
"providers": [
|
||||
"Modules\\Updater\\Providers\\UpdateServiceProvider"
|
||||
],
|
||||
"aliases": {},
|
||||
"files": [],
|
||||
"requires": []
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
"active": 1,
|
||||
"order": 0,
|
||||
"providers": [
|
||||
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\$STUDLY_NAME$ServiceProvider",
|
||||
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\AppServiceProvider",
|
||||
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\EventServiceProvider",
|
||||
"$MODULE_NAMESPACE$\\$STUDLY_NAME$\\Providers\\RouteServiceProvider"
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace $NAMESPACE$;
|
||||
namespace $MODULE_NAMESPACE$\$STUDLY_NAME$\Providers;
|
||||
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
@@ -16,7 +16,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = '$MODULE_NAMESPACE$\$MODULE$\Http\Controllers';
|
||||
protected $namespace = '$MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
@extends('$LOWER_NAME$::layouts.frontend')
|
||||
|
||||
@section('title', '$STUDLY_NAME$')
|
||||
|
||||
@section('content')
|
||||
<h1>Hello World</h1>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@foreach (session('flash_notification', collect())->toArray() as $message)
|
||||
@foreach (session('flash_notification', collect()) as $message)
|
||||
@if ($message['overlay'])
|
||||
@include('flash::modal', [
|
||||
'modalClass' => 'flash-modal',
|
||||
|
||||
@@ -74,6 +74,10 @@
|
||||
<li><a href="{!! url('/admin/pages') !!}"><i class="pe-7s-note"></i>pages/links</a></li>
|
||||
@endability
|
||||
|
||||
@ability('admin', 'modules')
|
||||
<li><a href="{!! url('/admin/modules') !!}"><i class="pe-7s-box2"></i>Modules Manager</a></li>
|
||||
@endability
|
||||
|
||||
@ability('admin', 'maintenance')
|
||||
<li><a href="{{ url('/admin/maintenance') }}"><i class="pe-7s-tools"></i>maintenance</a></li>
|
||||
@endability
|
||||
|
||||
37
resources/views/admin/modules/create.blade.php
Normal file
37
resources/views/admin/modules/create.blade.php
Normal file
@@ -0,0 +1,37 @@
|
||||
@extends('admin.app')
|
||||
@section('title', "Add Module")
|
||||
@section('content')
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
<h5>Please note that : </h5>
|
||||
<ul>
|
||||
<li>Module Folder must be on top level of the zip.</li>
|
||||
<li>Name of the zip must be exactly equal to the name of the module folder inside.</li>
|
||||
</ul>
|
||||
<h5>Module Zip Structure : </h5>
|
||||
<ul>
|
||||
<li>
|
||||
ModuleName.zip
|
||||
</li>
|
||||
<ul>
|
||||
<li>ModuleName Folder</li>
|
||||
<ul>
|
||||
<li>Config</li>
|
||||
<li>Console</li>
|
||||
<li>...</li>
|
||||
</ul>
|
||||
</ul>
|
||||
</ul>
|
||||
<hr>
|
||||
<form method="post" action="{{route('admin.modules.store')}}" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="form-group">
|
||||
<label>Module File : </label>
|
||||
<input type="file" name="module_file" class="form-control" />
|
||||
</div>
|
||||
<button class="btn btn-success" type="submit">Add Module</button>
|
||||
</form>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
35
resources/views/admin/modules/edit.blade.php
Normal file
35
resources/views/admin/modules/edit.blade.php
Normal file
@@ -0,0 +1,35 @@
|
||||
@extends('admin.app')
|
||||
@section('title', "Edit " . $module->name)
|
||||
@section('content')
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
<h5>Change Module Status : </h5>
|
||||
{{Form::open(['route' => ['admin.modules.update', $module->id]])}}
|
||||
|
||||
<div class="form-group">
|
||||
{{Form::label('Enabled ?')}}
|
||||
{{Form::checkbox('enabled', '', $module->enabled)}}
|
||||
</div>
|
||||
|
||||
{{ Form::button('Save', ['type' => 'submit', 'class' => 'btn btn-success']) }}
|
||||
{{Form::close()}}
|
||||
|
||||
<hr>
|
||||
|
||||
<h5>Delete Module</h5>
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
{{Form::open(['route' => ['admin.modules.destroy', $module->id], 'method' => 'delete'])}}
|
||||
|
||||
<div class="form-group">
|
||||
Type in <b>{{strtoupper($module->name)}}</b> to Delete :
|
||||
{{Form::text('verify', '', ['class' => 'form-control', 'required' => 'required'])}}
|
||||
</div>
|
||||
|
||||
{{ Form::button('Delete', ['type' => 'submit', 'class' => 'btn btn-danger']) }}
|
||||
{{Form::close()}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
79
resources/views/admin/modules/index.blade.php
Normal file
79
resources/views/admin/modules/index.blade.php
Normal file
@@ -0,0 +1,79 @@
|
||||
@extends('admin.app')
|
||||
@section('title', "Modules Manager")
|
||||
@section('actions')
|
||||
<li>
|
||||
<a href="{{ route('admin.modules.create') }}">
|
||||
<i class="ti-plus"></i>
|
||||
Add New</a>
|
||||
</li>
|
||||
@endsection
|
||||
@section('content')
|
||||
<div class="card border-blue-bottom">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h5>Installed Modules</h5>
|
||||
<hr>
|
||||
<table class="table table-bordered table-primary">
|
||||
<thead>
|
||||
<th>Module</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse($modules as $module)
|
||||
<tr>
|
||||
<td>{{$module->name}}</td>
|
||||
<td>
|
||||
@if($module->enabled == 1)
|
||||
Enabled
|
||||
@else
|
||||
Disabled
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
<a class="btn btn-primary" href="{{ route('admin.modules.edit', $module->id) }}">Edit Module</a>
|
||||
<a class="btn btn-danger" href="/admin/{{ strtolower($module->name) }}">View Admin Module</a>
|
||||
<a class="btn btn-success" target="_blank" href="/{{ strtolower($module->name) }}">View Frontend Module</a>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="3" class="text-center">
|
||||
No Modules Installed Yet!
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@if($new_modules)
|
||||
<h5>Not Installed Modules</h5>
|
||||
<hr>
|
||||
<table class="table table-bordered table-primary">
|
||||
<thead>
|
||||
<th>Module</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($new_modules as $module)
|
||||
<tr>
|
||||
<td>{{ $module }}</td>
|
||||
<td>Disabled</td>
|
||||
<td>
|
||||
{{Form::open(['route' => ['admin.modules.enable']])}}
|
||||
{{ Form::hidden('name', $module) }}
|
||||
{{ Form::button('Activate Module', ['type' => 'submit', 'class' => 'btn btn-success']) }}
|
||||
{{Form::close()}}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -53,7 +53,7 @@
|
||||
</div>
|
||||
<div class="card card-login card-plain" style="background: #FFF">
|
||||
<div class="card-body">
|
||||
@include('importer::flash.message')
|
||||
@include('system.importer.flash.message')
|
||||
@yield('content')
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,4 +1,4 @@
|
||||
@extends('importer::app')
|
||||
@extends('system.importer.app')
|
||||
@section('title', 'Import Completed!')
|
||||
|
||||
@section('content')
|
||||
@@ -1,4 +1,4 @@
|
||||
@extends('importer::app')
|
||||
@extends('system.importer.app')
|
||||
@section('title', 'Import Error!')
|
||||
|
||||
@section('content')
|
||||
@@ -1,4 +1,4 @@
|
||||
@extends('importer::app')
|
||||
@extends('system.importer.app')
|
||||
@section('title', 'Import Configuration')
|
||||
|
||||
@section('content')
|
||||
@@ -1,4 +1,4 @@
|
||||
@extends('importer::app')
|
||||
@extends('system.importer.app')
|
||||
@section('title', 'Import Configuration')
|
||||
|
||||
@section('content')
|
||||
@@ -53,7 +53,7 @@
|
||||
</div>
|
||||
<div class="card card-login card-plain" style="background: #FFF">
|
||||
<div class="card-body">
|
||||
@include('installer::flash.message')
|
||||
@include('system.installer.flash.message')
|
||||
@yield('content')
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,4 +1,4 @@
|
||||
@extends('installer::app')
|
||||
@extends('system.installer.app')
|
||||
|
||||
@section('content')
|
||||
<h2>phpVMS already installed!</h2>
|
||||
@@ -1,8 +1,8 @@
|
||||
@extends('installer::app')
|
||||
@extends('system.installer.app')
|
||||
@section('title', 'Install phpVMS')
|
||||
|
||||
@section('content')
|
||||
<p>Press continue to start</p>
|
||||
<h3 class="text-center">Click on <b>Start</b> to Continue</h3>
|
||||
{{ Form::open(['route' => 'installer.step1post', 'method' => 'post']) }}
|
||||
<p style="text-align: right">
|
||||
{{ Form::submit('Start >>', ['class' => 'btn btn-success']) }}
|
||||
@@ -1,4 +1,4 @@
|
||||
@extends('installer::app')
|
||||
@extends('system.installer.app')
|
||||
@section('title', 'Requirements Check')
|
||||
|
||||
@section('content')
|
||||
@@ -1,4 +1,4 @@
|
||||
@extends('installer::app')
|
||||
@extends('system.installer.app')
|
||||
@section('title', 'Database Setup')
|
||||
@section('content')
|
||||
<div style="align-content: center;">
|
||||
@@ -1,4 +1,4 @@
|
||||
@extends('installer::app')
|
||||
@extends('system.installer.app')
|
||||
@section('title', 'Database Setup Completed')
|
||||
@section('content')
|
||||
<div style="align-content: center;">
|
||||
@@ -1,4 +1,4 @@
|
||||
@extends('installer::app')
|
||||
@extends('system.installer.app')
|
||||
@section('title', 'User Setup')
|
||||
|
||||
@section('content')
|
||||
@@ -23,7 +23,7 @@
|
||||
<td>
|
||||
<div class="form-group">
|
||||
{{ Form::input('text', 'airline_icao', null, ['class' => 'form-control']) }}
|
||||
@include('installer::flash/check_error', ['field' => 'airline_icao'])
|
||||
@include('system.installer.flash/check_error', ['field' => 'airline_icao'])
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -33,7 +33,7 @@
|
||||
<td>
|
||||
<div class="form-group">
|
||||
{{ Form::input('text', 'airline_name', null, ['class' => 'form-control']) }}
|
||||
@include('installer::flash/check_error', ['field' => 'airline_name'])
|
||||
@include('system.installer.flash/check_error', ['field' => 'airline_name'])
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -43,7 +43,7 @@
|
||||
<td>
|
||||
<div class="form-group">
|
||||
{{ Form::select('airline_country', $countries, null, ['class' => 'form-control select2' ]) }}
|
||||
@include('installer::flash/check_error', ['field' => 'airline_country'])
|
||||
@include('system.installer.flash/check_error', ['field' => 'airline_country'])
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -57,7 +57,7 @@
|
||||
<td>
|
||||
<div class="form-group">
|
||||
{{ Form::input('text', 'name', null, ['class' => 'form-control']) }}
|
||||
@include('installer::flash/check_error', ['field' => 'name'])
|
||||
@include('system.installer.flash/check_error', ['field' => 'name'])
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -67,7 +67,7 @@
|
||||
<td>
|
||||
<div class="form-group">
|
||||
{{ Form::input('text', 'email', null, ['class' => 'form-control']) }}
|
||||
@include('installer::flash/check_error', ['field' => 'email'])
|
||||
@include('system.installer.flash/check_error', ['field' => 'email'])
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -76,7 +76,7 @@
|
||||
<td><p>Password</p></td>
|
||||
<td>
|
||||
{{ Form::password('password', ['class' => 'form-control']) }}
|
||||
@include('installer::flash/check_error', ['field' => 'password'])
|
||||
@include('system.installer.flash/check_error', ['field' => 'password'])
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
<td width="40%"><p>Password Confirm</p></td>
|
||||
<td>
|
||||
{{ Form::password('password_confirmation', ['class' => 'form-control']) }}
|
||||
@include('installer::flash/check_error', ['field' => 'password_confirmation'])
|
||||
@include('system.installer.flash/check_error', ['field' => 'password_confirmation'])
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@extends('installer::app')
|
||||
@extends('system.installer.app')
|
||||
@section('title', 'Installation Completed!')
|
||||
|
||||
@section('content')
|
||||
@@ -53,7 +53,7 @@
|
||||
</div>
|
||||
<div class="card card-login card-plain" style="background: #FFF">
|
||||
<div class="card-body">
|
||||
@include('updater::flash.message')
|
||||
@include('system.updater.flash.message')
|
||||
@yield('content')
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,4 +1,4 @@
|
||||
@extends('updater::app')
|
||||
@extends('system.updater.app')
|
||||
@section('title', 'Update phpVMS')
|
||||
|
||||
@section('content')
|
||||
@@ -1,4 +1,4 @@
|
||||
@extends('updater::app')
|
||||
@extends('system.updater.app')
|
||||
@section('title', 'Update phpVMS')
|
||||
|
||||
@section('content')
|
||||
@@ -1,4 +1,4 @@
|
||||
@extends('updater::app')
|
||||
@extends('system.updater.app')
|
||||
@section('title', 'Update phpVMS')
|
||||
|
||||
@section('content')
|
||||
@@ -1,4 +1,4 @@
|
||||
@extends('updater::app')
|
||||
@extends('system.updater.app')
|
||||
@section('title', 'Update phpVMS')
|
||||
|
||||
@section('content')
|
||||
@@ -1,4 +1,4 @@
|
||||
@extends('updater::app')
|
||||
@extends('system.updater.app')
|
||||
@section('title', 'Update Completed')
|
||||
@section('content')
|
||||
<div style="align-content: center;">
|
||||
@@ -1,4 +1,4 @@
|
||||
@extends('updater::app')
|
||||
@extends('system.updater.app')
|
||||
@section('title', 'Update Completed')
|
||||
|
||||
@section('content')
|
||||
Reference in New Issue
Block a user