fixing documentation area

This commit is contained in:
Mark Gregory
2026-06-15 08:27:36 +01:00
parent 5aa026d3c6
commit 1d647bf4ce
8 changed files with 235 additions and 42 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
return [
'name' => 'Documentation',
'storage_disk' => env('DOCUMENTATION_DISK', 'public'),
'upload_path' => env('DOCUMENTATION_UPLOAD_PATH', 'documentation'),
'max_upload_kb' => (int) env('DOCUMENTATION_MAX_UPLOAD_KB', 20480),
'max_markdown_import_bytes' => (int) env('DOCUMENTATION_MAX_MARKDOWN_IMPORT_BYTES', 1048576),
'import_markdown_attachments' => true,
'allowed_upload_mimes' => [
'pdf',
'doc',
'docx',
'xls',
'xlsx',
'ppt',
'pptx',
'txt',
'csv',
'md',
'markdown',
'png',
'jpg',
'jpeg',
'webp',
'zip',
],
'statuses' => [
'draft' => 'Draft',
'published' => 'Published',
'archived' => 'Archived',
],
];
@@ -0,0 +1,79 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
if (! Schema::hasTable('documentation_categories')) {
Schema::create('documentation_categories', function (Blueprint $table): void {
$table->id();
$table->string('name', 150);
$table->string('slug', 180)->unique();
$table->string('icon', 80)->nullable();
$table->string('colour', 32)->default('blue');
$table->text('description')->nullable();
$table->unsignedInteger('sort_order')->default(0)->index();
$table->boolean('is_active')->default(true)->index();
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamps();
});
}
if (! Schema::hasTable('documentation_documents')) {
Schema::create('documentation_documents', function (Blueprint $table): void {
$table->id();
$table->foreignId('documentation_category_id')->nullable()->constrained('documentation_categories')->nullOnDelete();
$table->string('title', 220);
$table->string('slug', 240)->unique();
$table->string('summary', 500)->nullable();
$table->longText('body')->nullable();
$table->string('status', 40)->default('draft')->index();
$table->boolean('is_featured')->default(false)->index();
$table->string('version', 50)->default('1.0.0');
$table->string('reference', 100)->nullable()->index();
$table->string('attachment_disk')->nullable();
$table->string('attachment_path')->nullable();
$table->string('attachment_name')->nullable();
$table->string('attachment_mime')->nullable();
$table->unsignedBigInteger('attachment_size')->nullable();
$table->timestamp('published_at')->nullable()->index();
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamps();
$table->softDeletes();
});
}
if (! Schema::hasTable('documentation_attachments')) {
Schema::create('documentation_attachments', function (Blueprint $table): void {
$table->id();
$table->foreignId('documentation_document_id')->constrained('documentation_documents')->cascadeOnDelete();
$table->string('disk')->default('public');
$table->string('path');
$table->string('original_name');
$table->string('mime_type')->nullable();
$table->unsignedBigInteger('size')->nullable();
$table->foreignId('uploaded_by')->nullable()->constrained('users')->nullOnDelete();
$table->timestamps();
});
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('documentation_attachments');
Schema::dropIfExists('documentation_documents');
Schema::dropIfExists('documentation_categories');
}
};
@@ -0,0 +1,58 @@
<?php
declare(strict_types=1);
namespace Modules\Documentation\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\ServiceProvider;
final class DocumentationServiceProvider extends ServiceProvider
{
/**
* Register module services.
*/
public function register(): void
{
$this->app->register(RouteServiceProvider::class);
$this->mergeConfigFrom(
module_path('Documentation', 'Config/config.php'),
'documentation'
);
}
/**
* Bootstrap module services.
*/
public function boot(): void
{
$this->registerViews();
$this->loadMigrationsFrom(module_path('Documentation', 'Database/Migrations'));
}
/**
* Register module views and anonymous components.
*/
private function registerViews(): void
{
$sourcePath = module_path('Documentation', 'Resources/views');
$overridePath = resource_path('views/modules/documentation');
$this->publishes([
$sourcePath => $overridePath,
], ['views', 'documentation-module-views']);
$paths = [$sourcePath];
foreach (Config::get('view.paths', []) as $path) {
if (is_dir($path.'/modules/documentation')) {
array_unshift($paths, $path.'/modules/documentation');
}
}
$this->loadViewsFrom($paths, 'documentation');
Blade::anonymousComponentPath($sourcePath.'/components', 'documentation');
}
}
@@ -1,10 +1,6 @@
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ trim($__env->yieldContent('title', 'Documentation')) }} - {{ config('app.name', 'Laravel') }}</title>
<style>
<x-layouts.app>
<style>
:root {
--doc-ink: #18181b;
--doc-muted: #71717a;
@@ -537,13 +533,15 @@
.doc-grid.stats { grid-template-columns: 1fr; }
.doc-hero { padding: 1.375rem; border-radius: 1.375rem; }
}
</style>
</head>
<body class="documentation-module">
<main class="doc-shell">
@yield('content')
</main>
<script>
</style>
<div class="mx-auto max-w-[1800px] space-y-6" dusk="documentation-module">
@yield('content')
</div>
<script>
document.addEventListener('click', function (event) {
const button = event.target.closest('[data-md-before]');
@@ -568,6 +566,6 @@
textarea.setRangeText(replacement, start, end, 'end');
textarea.focus();
});
</script>
</body>
</html>
</script>
</x-layouts.app>
+12
View File
@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
use Illuminate\Support\Facades\Route;
Route::middleware(['api', 'auth:sanctum'])
->prefix('documentation')
->name('api.documentation.')
->group(function (): void {
// Reserved for tenant-aware documentation API endpoints.
});
+27
View File
@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
use Illuminate\Support\Facades\Route;
use Modules\Documentation\Http\Controllers\DocumentationCategoryController;
use Modules\Documentation\Http\Controllers\DocumentationController;
Route::middleware(['web', 'auth'])
->prefix('documentation')
->name('documentation.')
->group(function (): void {
Route::get('/', [DocumentationController::class, 'index'])->name('index');
Route::get('/documents', [DocumentationController::class, 'index'])->name('documents.index');
Route::get('/documents/create', [DocumentationController::class, 'create'])->name('documents.create');
Route::post('/documents', [DocumentationController::class, 'store'])->name('documents.store');
Route::get('/documents/{document}', [DocumentationController::class, 'show'])->name('documents.show');
Route::get('/documents/{document}/edit', [DocumentationController::class, 'edit'])->name('documents.edit');
Route::put('/documents/{document}', [DocumentationController::class, 'update'])->name('documents.update');
Route::delete('/documents/{document}', [DocumentationController::class, 'destroy'])->name('documents.destroy');
Route::get('/documents/{document}/download', [DocumentationController::class, 'download'])->name('documents.download');
Route::get('/documents/{document}/attachments/{attachment}/download', [DocumentationController::class, 'downloadAttachment'])->name('documents.attachments.download');
Route::delete('/documents/{document}/attachments/{attachment}', [DocumentationController::class, 'destroyAttachment'])->name('documents.attachments.destroy');
Route::resource('categories', DocumentationCategoryController::class)->except(['show']);
});
+9 -23
View File
@@ -1,26 +1,12 @@
- version: 1.5.0
1.6.1:
date: 2026-06-15
changes:
- Updated the Documentation module visual theme to match the WMS/Helpdesk slate-blue shell, zinc cards, dark-mode surfaces, blue primary actions, emerald success states, red danger states, and amber warnings.
- Reworked the Documentation hero to use the same professional gradient/header pattern as the Helpdesk workflow screens.
- Added missing Documentation RouteServiceProvider so Composer package discovery and artisan commands can boot cleanly.
version: 1.4.0
date: 2026-06-15
changes:
- Added professional documentation dashboard and document CRUD.
- Added document categories with status, ordering, colour, and icon support.
- Added migrations, Eloquent models, form requests, routes, and feature coverage.
- Added self-contained Abbott-style module views with accessible responsive styling.
- Added Markdown upload processing for .md files with safe rendered HTML preview.
- Added Markdown import coverage and styling for headings, code blocks, tables, and blockquotes.
- Added multiple supporting attachments per document with upload, download, removal, storage cleanup, and tests.
- Added a free built-in Markdown editor toolbar with controls for headings, bold, italic, quotes, lists, links, inline code, fenced code blocks, and tables.
- Added WMS Support sidebar integration for Documentation, New Document, and Categories links using the existing sidebar colour scheme and active-state conventions.
- Added a root documentation.index route while preserving documentation.documents.index for CRUD navigation.
- Fixed module composer metadata and synced module.json version.
- version: 1.4.1
date: 2026-06-15
changes:
- Fixed sidebar integration so Documentation is rendered directly under the existing Support menu when Documentation routes exist.
- Added direct replacement Blade block for the current WMS app shell.
releases:
- version: 1.6.1
date: 2026-06-15
changes:
- Fixed missing DocumentationCategoryController binding failure for documentation category routes.
- Added explicit DocumentationServiceProvider, route files, config, and guarded migrations so the module registers cleanly in nwidart/laravel-modules.
- Preserved WMS shell styling and Documentation CRUD/Markdown/attachment functionality.
+2 -2
View File
@@ -1,8 +1,8 @@
{
"name": "Documentation",
"alias": "documentation",
"version": "1.5.0",
"description": "Professional document management and knowledge-base module with categories, CRUD, publishing, Markdown editing/import support, code blocks, attachments, and WMS Support navigation integration.",
"version": "1.6.1",
"description": "Professional document management and knowledge-base module with WMS shell styling, categories, CRUD, publishing, Markdown editing/import support, code blocks, attachments, and Support navigation integration.",
"keywords": [
"documentation",
"documents",