New design
This commit is contained in:
@@ -220,4 +220,21 @@ return [
|
|||||||
],
|
],
|
||||||
|
|
||||||
'activator' => 'database',
|
'activator' => 'database',
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Module control admin UI
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These settings control the package-provided module management screens.
|
||||||
|
| The UI uses the database activator and the module_statuses table.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
'admin' => [
|
||||||
|
'enabled' => true,
|
||||||
|
'prefix' => 'admin/modules',
|
||||||
|
'middleware' => ['web', 'auth'],
|
||||||
|
'layout_component' => 'layouts.app',
|
||||||
|
'hero_component' => 'wms.page-hero',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace mpba\Modules\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Routing\Controller;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
use mpba\Modules\Support\DatabaseModuleRegistry;
|
||||||
|
|
||||||
|
class ModuleControlController extends Controller
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
protected DatabaseModuleRegistry $registry,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function index(): View
|
||||||
|
{
|
||||||
|
return view('modules-control::index', [
|
||||||
|
'modules' => $this->registry->all(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function show(string $module): View
|
||||||
|
{
|
||||||
|
return view('modules-control::show', [
|
||||||
|
'module' => $this->registry->find($module),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function sync(): RedirectResponse
|
||||||
|
{
|
||||||
|
$this->registry->syncMissingStatuses();
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('modules.control.index')
|
||||||
|
->with('status', 'Module database statuses synced.');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function enable(string $module): RedirectResponse
|
||||||
|
{
|
||||||
|
$this->registry->enable($module);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('modules.control.index')
|
||||||
|
->with('status', "{$module} enabled in the database.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function disable(string $module): RedirectResponse
|
||||||
|
{
|
||||||
|
$this->registry->disable($module);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('modules.control.index')
|
||||||
|
->with('status', "{$module} disabled in the database.");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,21 @@ class LaravelModulesServiceProvider extends ModulesServiceProvider
|
|||||||
{
|
{
|
||||||
$this->registerNamespaces();
|
$this->registerNamespaces();
|
||||||
$this->registerModules();
|
$this->registerModules();
|
||||||
|
|
||||||
$this->loadMigrationsFrom(__DIR__.'/database/migrations');
|
$this->loadMigrationsFrom(__DIR__.'/database/migrations');
|
||||||
|
$this->loadViewsFrom(__DIR__.'/resources/views', 'modules-control');
|
||||||
|
|
||||||
|
$this->publishes([
|
||||||
|
__DIR__.'/database/migrations' => database_path('migrations'),
|
||||||
|
], 'modules-migrations');
|
||||||
|
|
||||||
|
$this->publishes([
|
||||||
|
__DIR__.'/Database/Seeders' => database_path('seeders/vendor/modules'),
|
||||||
|
], 'modules-seeders');
|
||||||
|
|
||||||
|
if ($this->app['config']->get('modules.admin.enabled', true)) {
|
||||||
|
$this->loadRoutesFrom(__DIR__.'/routes/web.php');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -26,6 +40,8 @@ class LaravelModulesServiceProvider extends ModulesServiceProvider
|
|||||||
$this->registerServices();
|
$this->registerServices();
|
||||||
$this->setupStubPath();
|
$this->setupStubPath();
|
||||||
$this->registerProviders();
|
$this->registerProviders();
|
||||||
|
|
||||||
|
$this->app->singleton(\mpba\Modules\Support\DatabaseModuleRegistry::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace mpba\Modules\Support;
|
||||||
|
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
use mpba\Modules\Contracts\RepositoryInterface;
|
||||||
|
use mpba\Modules\DevelopmentSupport\Entities\ModuleStatus;
|
||||||
|
use mpba\Modules\Module;
|
||||||
|
|
||||||
|
class DatabaseModuleRegistry
|
||||||
|
{
|
||||||
|
public function __construct(
|
||||||
|
protected RepositoryInterface $modules,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function all(): Collection
|
||||||
|
{
|
||||||
|
$this->syncMissingStatuses();
|
||||||
|
|
||||||
|
$statuses = ModuleStatus::query()
|
||||||
|
->get()
|
||||||
|
->keyBy('module');
|
||||||
|
|
||||||
|
return collect($this->modules->all())
|
||||||
|
->sortBy(fn (Module $module) => $module->get('order', 0))
|
||||||
|
->map(function (Module $module) use ($statuses): array {
|
||||||
|
$status = $statuses->get($module->getName());
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => $module->getName(),
|
||||||
|
'alias' => $module->getAlias(),
|
||||||
|
'description' => $module->getDescription(),
|
||||||
|
'version' => $module->get('version'),
|
||||||
|
'order' => $module->get('order', 0),
|
||||||
|
'path' => $module->getPath(),
|
||||||
|
'requires' => $module->getRequires(),
|
||||||
|
'enabled' => (bool) ($status?->enabled ?? $module->isEnabled()),
|
||||||
|
'status_record' => $status,
|
||||||
|
'module' => $module,
|
||||||
|
];
|
||||||
|
})
|
||||||
|
->values();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function find(string $name): array
|
||||||
|
{
|
||||||
|
$this->syncMissingStatuses();
|
||||||
|
|
||||||
|
/** @var Module $module */
|
||||||
|
$module = $this->modules->findOrFail($name);
|
||||||
|
$status = ModuleStatus::query()->firstOrCreate(
|
||||||
|
['module' => $module->getName()],
|
||||||
|
['enabled' => $module->isEnabled()]
|
||||||
|
);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => $module->getName(),
|
||||||
|
'alias' => $module->getAlias(),
|
||||||
|
'description' => $module->getDescription(),
|
||||||
|
'version' => $module->get('version'),
|
||||||
|
'order' => $module->get('order', 0),
|
||||||
|
'path' => $module->getPath(),
|
||||||
|
'requires' => $module->getRequires(),
|
||||||
|
'enabled' => (bool) $status->enabled,
|
||||||
|
'status_record' => $status,
|
||||||
|
'module' => $module,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function enable(string $name): void
|
||||||
|
{
|
||||||
|
$module = $this->modules->findOrFail($name);
|
||||||
|
|
||||||
|
ModuleStatus::query()->updateOrCreate(
|
||||||
|
['module' => $module->getName()],
|
||||||
|
['enabled' => true]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->modules->enable($module->getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function disable(string $name): void
|
||||||
|
{
|
||||||
|
$module = $this->modules->findOrFail($name);
|
||||||
|
|
||||||
|
ModuleStatus::query()->updateOrCreate(
|
||||||
|
['module' => $module->getName()],
|
||||||
|
['enabled' => false]
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->modules->disable($module->getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function syncMissingStatuses(): void
|
||||||
|
{
|
||||||
|
foreach ($this->modules->all() as $module) {
|
||||||
|
ModuleStatus::query()->firstOrCreate(
|
||||||
|
['module' => $module->getName()],
|
||||||
|
['enabled' => $module->isEnabled()]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace mpba\Modules\Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Illuminate\Support\Facades\File;
|
||||||
|
use mpba\Modules\DevelopmentSupport\Entities\ModuleStatus;
|
||||||
|
|
||||||
|
class ModuleStatusSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Seed missing database module statuses from the existing file activator JSON.
|
||||||
|
*
|
||||||
|
* Existing database rows are left unchanged.
|
||||||
|
*/
|
||||||
|
public function run(): void
|
||||||
|
{
|
||||||
|
foreach ($this->readStatuses() as $module => $enabled) {
|
||||||
|
if (! is_string($module) || trim($module) === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ModuleStatus::query()->firstOrCreate(
|
||||||
|
['module' => trim($module)],
|
||||||
|
['enabled' => (bool) $enabled]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, bool>
|
||||||
|
*/
|
||||||
|
private function readStatuses(): array
|
||||||
|
{
|
||||||
|
$path = $this->statusesFilePath();
|
||||||
|
|
||||||
|
if ($path === null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$statuses = json_decode(File::get($path), true);
|
||||||
|
|
||||||
|
if (! is_array($statuses)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $statuses;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function statusesFilePath(): ?string
|
||||||
|
{
|
||||||
|
$configuredPath = config('modules.activators.file.statuses-file');
|
||||||
|
|
||||||
|
$paths = array_filter(array_unique([
|
||||||
|
is_string($configuredPath) ? $configuredPath : null,
|
||||||
|
base_path('modules_statuses.json'),
|
||||||
|
base_path('module_statuses.json'),
|
||||||
|
base_path('module_statues.json'),
|
||||||
|
]));
|
||||||
|
|
||||||
|
foreach ($paths as $path) {
|
||||||
|
if (File::exists($path)) {
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
|
||||||
|
|
||||||
return new class extends Migration {
|
|
||||||
/**
|
|
||||||
* Run the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function up(): void
|
|
||||||
{
|
|
||||||
Schema::create('module_statuses', function (Blueprint $table): void {
|
|
||||||
$table->id();
|
|
||||||
$table->string('module')->unique();
|
|
||||||
$table->boolean('enabled')->default(true);
|
|
||||||
$table->timestamps();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reverse the migrations.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function down(): void
|
|
||||||
{
|
|
||||||
Schema::dropIfExists('module_statuses');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
+6
-4
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
@@ -8,11 +10,13 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
if (Schema::hasTable('module_statuses')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Schema::create('module_statuses', function (Blueprint $table): void {
|
Schema::create('module_statuses', function (Blueprint $table): void {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->string('module')->unique();
|
$table->string('module')->unique();
|
||||||
@@ -23,8 +27,6 @@ return new class extends Migration
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
@include('modules-control::partials.layout-open', ['title' => 'Module Control'])
|
||||||
|
<x-dynamic-component
|
||||||
|
:component="config('modules.admin.hero_component', 'wms.page-hero')"
|
||||||
|
title="Module Control"
|
||||||
|
subtitle="Database-backed module status control using the module_statuses table."
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="space-y-6">
|
||||||
|
@if (session('status'))
|
||||||
|
<div class="rounded-lg border border-green-200 bg-green-50 px-4 py-3 text-sm text-green-800">
|
||||||
|
{{ session('status') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
<div class="flex items-center justify-between gap-4">
|
||||||
|
<div>
|
||||||
|
<h2 class="text-lg font-semibold text-zinc-900 dark:text-zinc-100">Installed modules</h2>
|
||||||
|
<p class="text-sm text-zinc-500">Status is read from and written to the database, not modules_statuses.json.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="POST" action="{{ route('modules.control.sync') }}">
|
||||||
|
@csrf
|
||||||
|
<button type="submit" class="rounded-lg border border-zinc-300 px-4 py-2 text-sm font-semibold hover:bg-zinc-50 dark:border-zinc-700 dark:hover:bg-zinc-800">
|
||||||
|
Sync Database
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="overflow-hidden rounded-xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-800 dark:bg-zinc-900">
|
||||||
|
<table class="min-w-full divide-y divide-zinc-200 dark:divide-zinc-800">
|
||||||
|
<thead class="bg-zinc-50 dark:bg-zinc-950">
|
||||||
|
<tr>
|
||||||
|
<th class="px-4 py-3 text-left text-xs font-semibold uppercase text-zinc-500">Module</th>
|
||||||
|
<th class="px-4 py-3 text-left text-xs font-semibold uppercase text-zinc-500">Database Record</th>
|
||||||
|
<th class="px-4 py-3 text-left text-xs font-semibold uppercase text-zinc-500">Status</th>
|
||||||
|
<th class="px-4 py-3 text-right text-xs font-semibold uppercase text-zinc-500">Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody class="divide-y divide-zinc-200 dark:divide-zinc-800">
|
||||||
|
@forelse ($modules as $module)
|
||||||
|
<tr>
|
||||||
|
<td class="px-4 py-4">
|
||||||
|
<div class="font-medium text-zinc-900 dark:text-zinc-100">{{ $module['name'] }}</div>
|
||||||
|
<div class="text-sm text-zinc-500">{{ $module['description'] ?: 'No description provided.' }}</div>
|
||||||
|
<div class="mt-1 text-xs text-zinc-400">{{ $module['path'] }}</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="px-4 py-4 text-sm text-zinc-600 dark:text-zinc-400">
|
||||||
|
@if ($module['status_record'])
|
||||||
|
<div>ID: {{ $module['status_record']->id }}</div>
|
||||||
|
<div>module: {{ $module['status_record']->module }}</div>
|
||||||
|
@else
|
||||||
|
<span class="text-red-600">Missing</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="px-4 py-4">
|
||||||
|
@if ($module['enabled'])
|
||||||
|
<span class="rounded-full bg-green-100 px-3 py-1 text-xs font-medium text-green-700">Enabled</span>
|
||||||
|
@else
|
||||||
|
<span class="rounded-full bg-red-100 px-3 py-1 text-xs font-medium text-red-700">Disabled</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="px-4 py-4">
|
||||||
|
<div class="flex justify-end gap-2">
|
||||||
|
<a href="{{ route('modules.control.show', $module['name']) }}" class="rounded-lg border border-zinc-300 px-3 py-1.5 text-sm hover:bg-zinc-50 dark:border-zinc-700 dark:hover:bg-zinc-800">View</a>
|
||||||
|
|
||||||
|
@if ($module['enabled'])
|
||||||
|
<form method="POST" action="{{ route('modules.control.disable', $module['name']) }}">
|
||||||
|
@csrf
|
||||||
|
<button type="submit" class="rounded-lg bg-red-600 px-3 py-1.5 text-sm font-semibold text-white hover:bg-red-700">Disable</button>
|
||||||
|
</form>
|
||||||
|
@else
|
||||||
|
<form method="POST" action="{{ route('modules.control.enable', $module['name']) }}">
|
||||||
|
@csrf
|
||||||
|
<button type="submit" class="rounded-lg bg-green-600 px-3 py-1.5 text-sm font-semibold text-white hover:bg-green-700">Enable</button>
|
||||||
|
</form>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@empty
|
||||||
|
<tr>
|
||||||
|
<td colspan="4" class="px-4 py-8 text-center text-sm text-zinc-500">No modules found on disk.</td>
|
||||||
|
</tr>
|
||||||
|
@endforelse
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@include('modules-control::partials.layout-close')
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
</x-dynamic-component>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<x-dynamic-component :component="config('modules.admin.layout_component', 'layouts.app')" :title="$title ?? 'Module Control'">
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
@include('modules-control::partials.layout-open', ['title' => $module['name'].' Module'])
|
||||||
|
<x-dynamic-component
|
||||||
|
:component="config('modules.admin.hero_component', 'wms.page-hero')"
|
||||||
|
:title="$module['name'].' Module'"
|
||||||
|
subtitle="Database-backed module details and activation state."
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div class="space-y-6">
|
||||||
|
<div class="rounded-xl border border-zinc-200 bg-white p-6 shadow-sm dark:border-zinc-800 dark:bg-zinc-900">
|
||||||
|
<dl class="grid gap-4 md:grid-cols-2">
|
||||||
|
<div>
|
||||||
|
<dt class="text-xs font-semibold uppercase text-zinc-500">Module</dt>
|
||||||
|
<dd class="mt-1 text-sm text-zinc-900 dark:text-zinc-100">{{ $module['name'] }}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt class="text-xs font-semibold uppercase text-zinc-500">Alias</dt>
|
||||||
|
<dd class="mt-1 text-sm text-zinc-900 dark:text-zinc-100">{{ $module['alias'] }}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt class="text-xs font-semibold uppercase text-zinc-500">Version</dt>
|
||||||
|
<dd class="mt-1 text-sm text-zinc-900 dark:text-zinc-100">{{ $module['version'] ?: '—' }}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt class="text-xs font-semibold uppercase text-zinc-500">Database enabled</dt>
|
||||||
|
<dd class="mt-1 text-sm text-zinc-900 dark:text-zinc-100">{{ $module['enabled'] ? 'Yes' : 'No' }}</dd>
|
||||||
|
</div>
|
||||||
|
<div class="md:col-span-2">
|
||||||
|
<dt class="text-xs font-semibold uppercase text-zinc-500">Path</dt>
|
||||||
|
<dd class="mt-1 text-sm text-zinc-900 dark:text-zinc-100">{{ $module['path'] }}</dd>
|
||||||
|
</div>
|
||||||
|
<div class="md:col-span-2">
|
||||||
|
<dt class="text-xs font-semibold uppercase text-zinc-500">Requires</dt>
|
||||||
|
<dd class="mt-1 text-sm text-zinc-900 dark:text-zinc-100">
|
||||||
|
{{ empty($module['requires']) ? 'None' : implode(', ', $module['requires']) }}
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex gap-3">
|
||||||
|
<a href="{{ route('modules.control.index') }}" class="rounded-lg border border-zinc-300 px-4 py-2 text-sm font-semibold hover:bg-zinc-50 dark:border-zinc-700 dark:hover:bg-zinc-800">Back</a>
|
||||||
|
|
||||||
|
@if ($module['enabled'])
|
||||||
|
<form method="POST" action="{{ route('modules.control.disable', $module['name']) }}">
|
||||||
|
@csrf
|
||||||
|
<button type="submit" class="rounded-lg bg-red-600 px-4 py-2 text-sm font-semibold text-white hover:bg-red-700">Disable Module</button>
|
||||||
|
</form>
|
||||||
|
@else
|
||||||
|
<form method="POST" action="{{ route('modules.control.enable', $module['name']) }}">
|
||||||
|
@csrf
|
||||||
|
<button type="submit" class="rounded-lg bg-green-600 px-4 py-2 text-sm font-semibold text-white hover:bg-green-700">Enable Module</button>
|
||||||
|
</form>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@include('modules-control::partials.layout-close')
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
use mpba\Modules\Http\Controllers\ModuleControlController;
|
||||||
|
|
||||||
|
Route::middleware(config('modules.admin.middleware', ['web', 'auth']))
|
||||||
|
->prefix(config('modules.admin.prefix', 'admin/modules'))
|
||||||
|
->name('modules.control.')
|
||||||
|
->group(function (): void {
|
||||||
|
Route::get('/', [ModuleControlController::class, 'index'])->name('index');
|
||||||
|
Route::post('/sync', [ModuleControlController::class, 'sync'])->name('sync');
|
||||||
|
Route::get('/{module}', [ModuleControlController::class, 'show'])->name('show');
|
||||||
|
Route::post('/{module}/enable', [ModuleControlController::class, 'enable'])->name('enable');
|
||||||
|
Route::post('/{module}/disable', [ModuleControlController::class, 'disable'])->name('disable');
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user