phase two updates

This commit is contained in:
Mark Gregory
2026-07-24 09:45:41 +01:00
parent c2a19a16e6
commit 9204625c2f
114 changed files with 1480 additions and 1 deletions
+3
View File
@@ -0,0 +1,3 @@
<?php
return ['name' => 'Banners'];
@@ -0,0 +1,16 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void { Schema::create('banners', function (Blueprint $table): void { $table->id();
$table->string('title');
$table->text('content')->nullable();
$table->string('link_url')->nullable();
$table->string('position')->default('default');
$table->boolean('enabled')->default(true);
$table->timestamps(); $table->softDeletes(); }); }
public function down(): void { Schema::dropIfExists('banners'); }
};
@@ -0,0 +1,27 @@
<?php
namespace Modules\Banners\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
use Modules\Banners\Models\Banner;
final class BannerController extends Controller
{
public function index(): View { return view('banners::admin.index', ['records' => Banner::query()->latest()->paginate(20)]); }
public function create(): View { return view('banners::admin.form'); }
public function store(Request $request): RedirectResponse { $data = $request->validate(['title' => ['required', 'string', 'max:255'],
'content' => ['nullable', 'string'],
'link_url' => ['nullable', 'string'],
'position' => ['required', 'string', 'max:255'],
'enabled' => ['sometimes', 'boolean']]); $data['enabled'] = $request->boolean('enabled'); Banner::create($data); return redirect()->route('banners.index')->with('status', 'Banner created.'); }
public function edit(Banner $banner): View { return view('banners::admin.form', ['record' => $banner]); }
public function update(Request $request, Banner $banner): RedirectResponse { $data = $request->validate(['title' => ['required', 'string', 'max:255'],
'content' => ['nullable', 'string'],
'link_url' => ['nullable', 'string'],
'position' => ['required', 'string', 'max:255'],
'enabled' => ['sometimes', 'boolean']]); $data['enabled'] = $request->boolean('enabled'); $banner->update($data); return redirect()->route('banners.index')->with('status', 'Banner updated.'); }
public function destroy(Banner $banner): RedirectResponse { $banner->delete(); return back()->with('status', 'Banner deleted.'); }
}
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace Modules\Banners\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
final class Banner extends Model
{
use HasFactory, SoftDeletes;
protected $table = 'banners';
protected $fillable = ['title', 'content', 'link_url', 'position', 'enabled'];
protected function casts(): array { return [
'enabled' => 'boolean'
]; }
}
@@ -0,0 +1,20 @@
<?php
namespace Modules\Banners\Providers;
use Illuminate\Support\ServiceProvider;
final class BannersServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->register(RouteServiceProvider::class);
$this->mergeConfigFrom(module_path('Banners', 'Config/config.php'), 'banners');
}
public function boot(): void
{
$this->loadMigrationsFrom(module_path('Banners', 'Database/Migrations'));
$this->loadViewsFrom(module_path('Banners', 'Resources/views'), 'banners');
}
}
@@ -0,0 +1,15 @@
<?php
namespace Modules\Banners\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
final class RouteServiceProvider extends ServiceProvider
{
public function boot(): void
{
parent::boot();
$this->routes(fn () => Route::middleware('web')->group(module_path('Banners', 'Routes/web.php')));
}
}
@@ -0,0 +1,9 @@
<x-layouts.app :title="isset($record) ? __('Edit Banner') : __('Create Banner')">
<div class="mx-auto max-w-4xl space-y-6"><div><h1 class="text-2xl font-semibold">{{ isset($record) ? 'Edit' : 'Create' }} Banner</h1></div><form method="POST" action="{{ isset($record) ? route('administration.banners.update', $record) : route('administration.banners.store') }}" class="space-y-5 rounded-xl border border-zinc-200 bg-white p-6 dark:border-zinc-700 dark:bg-zinc-900">@csrf @isset($record) @method('PUT') @endisset
<div><label class="mb-1 block text-sm font-medium">Title</label><input type="text" name="title" value="{{ old('title', $record->title ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('title')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Content</label><textarea name="content" rows="4" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">{{ old('content', $record->content ?? '') }}</textarea>@error('content')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Link Url</label><input type="text" name="link_url" value="{{ old('link_url', $record->link_url ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('link_url')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Position</label><input type="text" name="position" value="{{ old('position', $record->position ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('position')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<label class="flex items-center gap-2"><input type="checkbox" name="enabled" value="1" @checked(old('enabled', $record->enabled ?? true))><span>Enabled</span></label>
<div class="flex gap-3"><button class="rounded-lg bg-zinc-900 px-4 py-2 text-white dark:bg-white dark:text-zinc-900">Save</button><a href="{{ route('administration.banners.index') }}" class="rounded-lg border px-4 py-2">Cancel</a></div></form></div>
</x-layouts.app>
@@ -0,0 +1,5 @@
<x-layouts.app :title="__('Banners')">
<div class="space-y-6"><div class="flex items-center justify-between"><div><h1 class="text-2xl font-semibold">Banners</h1><p class="text-sm text-zinc-500">Manage banners content.</p></div><a href="{{ route('administration.banners.create') }}" class="rounded-lg bg-zinc-900 px-4 py-2 text-sm text-white dark:bg-white dark:text-zinc-900">Add new</a></div>
@if(session('status'))<div class="rounded-lg bg-emerald-50 p-3 text-emerald-800">{{ session('status') }}</div>@endif
<div class="overflow-hidden rounded-xl border border-zinc-200 bg-white dark:border-zinc-700 dark:bg-zinc-900"><table class="w-full text-sm"><thead class="bg-zinc-50 dark:bg-zinc-800"><tr><th class="px-4 py-3 text-left">Title</th><th class="px-4 py-3 text-left">Content</th><th class="px-4 py-3 text-left">Link Url</th><th class="px-4 py-3 text-right">Actions</th></tr></thead><tbody class="divide-y divide-zinc-200 dark:divide-zinc-800">@forelse($records as $record)<tr><td class="px-4 py-3">{{ is_array($record->title) ? json_encode($record->title) : Str::limit((string) $record->title, 70) }}</td><td class="px-4 py-3">{{ is_array($record->content) ? json_encode($record->content) : Str::limit((string) $record->content, 70) }}</td><td class="px-4 py-3">{{ is_array($record->link_url) ? json_encode($record->link_url) : Str::limit((string) $record->link_url, 70) }}</td><td class="px-4 py-3 text-right"><a class="mr-3 underline" href="{{ route('administration.banners.edit', $record) }}">Edit</a><form class="inline" method="POST" action="{{ route('administration.banners.destroy', $record) }}">@csrf @method('DELETE')<button class="text-red-600" onclick="return confirm('Delete this record?')">Delete</button></form></td></tr>@empty<tr><td colspan="4" class="px-4 py-10 text-center text-zinc-500">No records yet.</td></tr>@endforelse</tbody></table></div>{{ $records->links() }}</div>
</x-layouts.app>
+8
View File
@@ -0,0 +1,8 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Banners\Http\Controllers\BannerController;
Route::middleware(['auth', 'verified'])->prefix('administration/banners')->name('administration.banners.')->group(function (): void {
Route::resource('/', BannerController::class)->parameters(['' => 'banner'])->except('show');
});
+5
View File
@@ -0,0 +1,5 @@
<?php
namespace Modules\Banners\Support;
final class ModuleInfo { public static function name(): string { return 'Banners'; } public static function nameLower(): string { return 'banners'; } }
@@ -0,0 +1,5 @@
<?php
use Illuminate\Support\Facades\Route;
it('registers the Banners administration route', function (): void { expect(Route::has('administration.banners.index'))->toBeTrue(); });
+20
View File
@@ -0,0 +1,20 @@
{
"name": "Banners",
"alias": "banners",
"version": "1.0.0",
"description": "Banners CMS module.",
"keywords": [
"cms",
"banners"
],
"priority": 26,
"providers": [
"Modules\\Banners\\Providers\\BannersServiceProvider"
],
"aliases": {},
"files": [],
"requires": [
"Core",
"Administration"
]
}
+3
View File
@@ -0,0 +1,3 @@
<?php
return ['name' => 'Documents'];
@@ -0,0 +1,15 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void { Schema::create('documents', function (Blueprint $table): void { $table->id();
$table->string('title');
$table->text('description')->nullable();
$table->string('file_path')->nullable();
$table->boolean('is_public')->default(true);
$table->timestamps(); $table->softDeletes(); }); }
public function down(): void { Schema::dropIfExists('documents'); }
};
@@ -0,0 +1,25 @@
<?php
namespace Modules\Documents\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
use Modules\Documents\Models\Document;
final class DocumentController extends Controller
{
public function index(): View { return view('documents::admin.index', ['records' => Document::query()->latest()->paginate(20)]); }
public function create(): View { return view('documents::admin.form'); }
public function store(Request $request): RedirectResponse { $data = $request->validate(['title' => ['required', 'string', 'max:255'],
'description' => ['nullable', 'string'],
'file_path' => ['nullable', 'string'],
'is_public' => ['sometimes', 'boolean']]); $data['is_public'] = $request->boolean('is_public'); Document::create($data); return redirect()->route('documents.index')->with('status', 'Document created.'); }
public function edit(Document $document): View { return view('documents::admin.form', ['record' => $document]); }
public function update(Request $request, Document $document): RedirectResponse { $data = $request->validate(['title' => ['required', 'string', 'max:255'],
'description' => ['nullable', 'string'],
'file_path' => ['nullable', 'string'],
'is_public' => ['sometimes', 'boolean']]); $data['is_public'] = $request->boolean('is_public'); $document->update($data); return redirect()->route('documents.index')->with('status', 'Document updated.'); }
public function destroy(Document $document): RedirectResponse { $document->delete(); return back()->with('status', 'Document deleted.'); }
}
+19
View File
@@ -0,0 +1,19 @@
<?php
namespace Modules\Documents\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
final class Document extends Model
{
use HasFactory, SoftDeletes;
protected $table = 'documents';
protected $fillable = ['title', 'description', 'file_path', 'is_public'];
protected function casts(): array { return [
'is_public' => 'boolean'
]; }
}
@@ -0,0 +1,20 @@
<?php
namespace Modules\Documents\Providers;
use Illuminate\Support\ServiceProvider;
final class DocumentsServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->register(RouteServiceProvider::class);
$this->mergeConfigFrom(module_path('Documents', 'Config/config.php'), 'documents');
}
public function boot(): void
{
$this->loadMigrationsFrom(module_path('Documents', 'Database/Migrations'));
$this->loadViewsFrom(module_path('Documents', 'Resources/views'), 'documents');
}
}
@@ -0,0 +1,15 @@
<?php
namespace Modules\Documents\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
final class RouteServiceProvider extends ServiceProvider
{
public function boot(): void
{
parent::boot();
$this->routes(fn () => Route::middleware('web')->group(module_path('Documents', 'Routes/web.php')));
}
}
@@ -0,0 +1,8 @@
<x-layouts.app :title="isset($record) ? __('Edit Document') : __('Create Document')">
<div class="mx-auto max-w-4xl space-y-6"><div><h1 class="text-2xl font-semibold">{{ isset($record) ? 'Edit' : 'Create' }} Document</h1></div><form method="POST" action="{{ isset($record) ? route('administration.documents.update', $record) : route('administration.documents.store') }}" class="space-y-5 rounded-xl border border-zinc-200 bg-white p-6 dark:border-zinc-700 dark:bg-zinc-900">@csrf @isset($record) @method('PUT') @endisset
<div><label class="mb-1 block text-sm font-medium">Title</label><input type="text" name="title" value="{{ old('title', $record->title ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('title')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Description</label><textarea name="description" rows="4" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">{{ old('description', $record->description ?? '') }}</textarea>@error('description')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">File Path</label><input type="text" name="file_path" value="{{ old('file_path', $record->file_path ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('file_path')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<label class="flex items-center gap-2"><input type="checkbox" name="is_public" value="1" @checked(old('is_public', $record->is_public ?? true))><span>Is Public</span></label>
<div class="flex gap-3"><button class="rounded-lg bg-zinc-900 px-4 py-2 text-white dark:bg-white dark:text-zinc-900">Save</button><a href="{{ route('administration.documents.index') }}" class="rounded-lg border px-4 py-2">Cancel</a></div></form></div>
</x-layouts.app>
@@ -0,0 +1,5 @@
<x-layouts.app :title="__('Documents')">
<div class="space-y-6"><div class="flex items-center justify-between"><div><h1 class="text-2xl font-semibold">Documents</h1><p class="text-sm text-zinc-500">Manage documents content.</p></div><a href="{{ route('administration.documents.create') }}" class="rounded-lg bg-zinc-900 px-4 py-2 text-sm text-white dark:bg-white dark:text-zinc-900">Add new</a></div>
@if(session('status'))<div class="rounded-lg bg-emerald-50 p-3 text-emerald-800">{{ session('status') }}</div>@endif
<div class="overflow-hidden rounded-xl border border-zinc-200 bg-white dark:border-zinc-700 dark:bg-zinc-900"><table class="w-full text-sm"><thead class="bg-zinc-50 dark:bg-zinc-800"><tr><th class="px-4 py-3 text-left">Title</th><th class="px-4 py-3 text-left">Description</th><th class="px-4 py-3 text-left">File Path</th><th class="px-4 py-3 text-right">Actions</th></tr></thead><tbody class="divide-y divide-zinc-200 dark:divide-zinc-800">@forelse($records as $record)<tr><td class="px-4 py-3">{{ is_array($record->title) ? json_encode($record->title) : Str::limit((string) $record->title, 70) }}</td><td class="px-4 py-3">{{ is_array($record->description) ? json_encode($record->description) : Str::limit((string) $record->description, 70) }}</td><td class="px-4 py-3">{{ is_array($record->file_path) ? json_encode($record->file_path) : Str::limit((string) $record->file_path, 70) }}</td><td class="px-4 py-3 text-right"><a class="mr-3 underline" href="{{ route('administration.documents.edit', $record) }}">Edit</a><form class="inline" method="POST" action="{{ route('administration.documents.destroy', $record) }}">@csrf @method('DELETE')<button class="text-red-600" onclick="return confirm('Delete this record?')">Delete</button></form></td></tr>@empty<tr><td colspan="4" class="px-4 py-10 text-center text-zinc-500">No records yet.</td></tr>@endforelse</tbody></table></div>{{ $records->links() }}</div>
</x-layouts.app>
+8
View File
@@ -0,0 +1,8 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Documents\Http\Controllers\DocumentController;
Route::middleware(['auth', 'verified'])->prefix('administration/documents')->name('administration.documents.')->group(function (): void {
Route::resource('/', DocumentController::class)->parameters(['' => 'document'])->except('show');
});
+5
View File
@@ -0,0 +1,5 @@
<?php
namespace Modules\Documents\Support;
final class ModuleInfo { public static function name(): string { return 'Documents'; } public static function nameLower(): string { return 'documents'; } }
@@ -0,0 +1,5 @@
<?php
use Illuminate\Support\Facades\Route;
it('registers the Documents administration route', function (): void { expect(Route::has('administration.documents.index'))->toBeTrue(); });
+20
View File
@@ -0,0 +1,20 @@
{
"name": "Documents",
"alias": "documents",
"version": "1.0.0",
"description": "Documents CMS module.",
"keywords": [
"cms",
"documents"
],
"priority": 25,
"providers": [
"Modules\\Documents\\Providers\\DocumentsServiceProvider"
],
"aliases": {},
"files": [],
"requires": [
"Core",
"Administration"
]
}
+3
View File
@@ -0,0 +1,3 @@
<?php
return ['name' => 'Faq'];
@@ -0,0 +1,16 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void { Schema::create('faqs', function (Blueprint $table): void { $table->id();
$table->string('question');
$table->longText('answer');
$table->string('category')->nullable();
$table->unsignedInteger('sort_order')->default(0);
$table->boolean('enabled')->default(true);
$table->timestamps(); $table->softDeletes(); }); }
public function down(): void { Schema::dropIfExists('faqs'); }
};
@@ -0,0 +1,27 @@
<?php
namespace Modules\Faq\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
use Modules\Faq\Models\Faq;
final class FaqController extends Controller
{
public function index(): View { return view('faq::admin.index', ['records' => Faq::query()->latest()->paginate(20)]); }
public function create(): View { return view('faq::admin.form'); }
public function store(Request $request): RedirectResponse { $data = $request->validate(['question' => ['required', 'string', 'max:255'],
'answer' => ['required', 'string'],
'category' => ['nullable', 'string'],
'sort_order' => ['nullable', 'integer', 'min:0'],
'enabled' => ['sometimes', 'boolean']]); $data['enabled'] = $request->boolean('enabled'); Faq::create($data); return redirect()->route('faq.index')->with('status', 'Faq created.'); }
public function edit(Faq $faq): View { return view('faq::admin.form', ['record' => $faq]); }
public function update(Request $request, Faq $faq): RedirectResponse { $data = $request->validate(['question' => ['required', 'string', 'max:255'],
'answer' => ['required', 'string'],
'category' => ['nullable', 'string'],
'sort_order' => ['nullable', 'integer', 'min:0'],
'enabled' => ['sometimes', 'boolean']]); $data['enabled'] = $request->boolean('enabled'); $faq->update($data); return redirect()->route('faq.index')->with('status', 'Faq updated.'); }
public function destroy(Faq $faq): RedirectResponse { $faq->delete(); return back()->with('status', 'Faq deleted.'); }
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace Modules\Faq\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
final class Faq extends Model
{
use HasFactory, SoftDeletes;
protected $table = 'faqs';
protected $fillable = ['question', 'answer', 'category', 'sort_order', 'enabled'];
protected function casts(): array { return [
'sort_order' => 'integer',
'enabled' => 'boolean'
]; }
}
@@ -0,0 +1,20 @@
<?php
namespace Modules\Faq\Providers;
use Illuminate\Support\ServiceProvider;
final class FaqServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->register(RouteServiceProvider::class);
$this->mergeConfigFrom(module_path('Faq', 'Config/config.php'), 'faq');
}
public function boot(): void
{
$this->loadMigrationsFrom(module_path('Faq', 'Database/Migrations'));
$this->loadViewsFrom(module_path('Faq', 'Resources/views'), 'faq');
}
}
@@ -0,0 +1,15 @@
<?php
namespace Modules\Faq\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
final class RouteServiceProvider extends ServiceProvider
{
public function boot(): void
{
parent::boot();
$this->routes(fn () => Route::middleware('web')->group(module_path('Faq', 'Routes/web.php')));
}
}
@@ -0,0 +1,9 @@
<x-layouts.app :title="isset($record) ? __('Edit Faq') : __('Create Faq')">
<div class="mx-auto max-w-4xl space-y-6"><div><h1 class="text-2xl font-semibold">{{ isset($record) ? 'Edit' : 'Create' }} Faq</h1></div><form method="POST" action="{{ isset($record) ? route('administration.faq.update', $record) : route('administration.faq.store') }}" class="space-y-5 rounded-xl border border-zinc-200 bg-white p-6 dark:border-zinc-700 dark:bg-zinc-900">@csrf @isset($record) @method('PUT') @endisset
<div><label class="mb-1 block text-sm font-medium">Question</label><input type="text" name="question" value="{{ old('question', $record->question ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('question')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Answer</label><textarea name="answer" rows="8" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">{{ old('answer', $record->answer ?? '') }}</textarea>@error('answer')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Category</label><input type="text" name="category" value="{{ old('category', $record->category ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('category')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Sort Order</label><input type="number" name="sort_order" value="{{ old('sort_order', $record->sort_order ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('sort_order')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<label class="flex items-center gap-2"><input type="checkbox" name="enabled" value="1" @checked(old('enabled', $record->enabled ?? true))><span>Enabled</span></label>
<div class="flex gap-3"><button class="rounded-lg bg-zinc-900 px-4 py-2 text-white dark:bg-white dark:text-zinc-900">Save</button><a href="{{ route('administration.faq.index') }}" class="rounded-lg border px-4 py-2">Cancel</a></div></form></div>
</x-layouts.app>
@@ -0,0 +1,5 @@
<x-layouts.app :title="__('Faq')">
<div class="space-y-6"><div class="flex items-center justify-between"><div><h1 class="text-2xl font-semibold">Faq</h1><p class="text-sm text-zinc-500">Manage faq content.</p></div><a href="{{ route('administration.faq.create') }}" class="rounded-lg bg-zinc-900 px-4 py-2 text-sm text-white dark:bg-white dark:text-zinc-900">Add new</a></div>
@if(session('status'))<div class="rounded-lg bg-emerald-50 p-3 text-emerald-800">{{ session('status') }}</div>@endif
<div class="overflow-hidden rounded-xl border border-zinc-200 bg-white dark:border-zinc-700 dark:bg-zinc-900"><table class="w-full text-sm"><thead class="bg-zinc-50 dark:bg-zinc-800"><tr><th class="px-4 py-3 text-left">Question</th><th class="px-4 py-3 text-left">Answer</th><th class="px-4 py-3 text-left">Category</th><th class="px-4 py-3 text-right">Actions</th></tr></thead><tbody class="divide-y divide-zinc-200 dark:divide-zinc-800">@forelse($records as $record)<tr><td class="px-4 py-3">{{ is_array($record->question) ? json_encode($record->question) : Str::limit((string) $record->question, 70) }}</td><td class="px-4 py-3">{{ is_array($record->answer) ? json_encode($record->answer) : Str::limit((string) $record->answer, 70) }}</td><td class="px-4 py-3">{{ is_array($record->category) ? json_encode($record->category) : Str::limit((string) $record->category, 70) }}</td><td class="px-4 py-3 text-right"><a class="mr-3 underline" href="{{ route('administration.faq.edit', $record) }}">Edit</a><form class="inline" method="POST" action="{{ route('administration.faq.destroy', $record) }}">@csrf @method('DELETE')<button class="text-red-600" onclick="return confirm('Delete this record?')">Delete</button></form></td></tr>@empty<tr><td colspan="4" class="px-4 py-10 text-center text-zinc-500">No records yet.</td></tr>@endforelse</tbody></table></div>{{ $records->links() }}</div>
</x-layouts.app>
+8
View File
@@ -0,0 +1,8 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Faq\Http\Controllers\FaqController;
Route::middleware(['auth', 'verified'])->prefix('administration/faq')->name('administration.faq.')->group(function (): void {
Route::resource('/', FaqController::class)->parameters(['' => 'faq'])->except('show');
});
+5
View File
@@ -0,0 +1,5 @@
<?php
namespace Modules\Faq\Support;
final class ModuleInfo { public static function name(): string { return 'Faq'; } public static function nameLower(): string { return 'faq'; } }
@@ -0,0 +1,5 @@
<?php
use Illuminate\Support\Facades\Route;
it('registers the Faq administration route', function (): void { expect(Route::has('administration.faq.index'))->toBeTrue(); });
+20
View File
@@ -0,0 +1,20 @@
{
"name": "Faq",
"alias": "faq",
"version": "1.0.0",
"description": "Faq CMS module.",
"keywords": [
"cms",
"faq"
],
"priority": 27,
"providers": [
"Modules\\Faq\\Providers\\FaqServiceProvider"
],
"aliases": {},
"files": [],
"requires": [
"Core",
"Administration"
]
}
+3
View File
@@ -0,0 +1,3 @@
<?php
return ['name' => 'Forms'];
@@ -0,0 +1,16 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void { Schema::create('forms', function (Blueprint $table): void { $table->id();
$table->string('name');
$table->string('slug');
$table->text('description')->nullable();
$table->json('schema')->nullable();
$table->boolean('enabled')->default(true);
$table->timestamps(); $table->softDeletes(); }); }
public function down(): void { Schema::dropIfExists('forms'); }
};
@@ -0,0 +1,29 @@
<?php
namespace Modules\Forms\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
use Modules\Forms\Models\Form;
final class FormController extends Controller
{
public function index(): View { return view('forms::admin.index', ['records' => Form::query()->latest()->paginate(20)]); }
public function create(): View { return view('forms::admin.form'); }
public function store(Request $request): RedirectResponse { $data = $request->validate(['name' => ['required', 'string', 'max:255'],
'slug' => ['required', 'string', 'max:255'],
'description' => ['nullable', 'string'],
'schema' => ['nullable', 'array'],
'enabled' => ['sometimes', 'boolean']]); if ($request->filled('schema_json')) { $data['schema'] = json_decode($request->string('schema_json')->toString(), true, 512, JSON_THROW_ON_ERROR); }
$data['enabled'] = $request->boolean('enabled'); Form::create($data); return redirect()->route('forms.index')->with('status', 'Form created.'); }
public function edit(Form $form): View { return view('forms::admin.form', ['record' => $form]); }
public function update(Request $request, Form $form): RedirectResponse { $data = $request->validate(['name' => ['required', 'string', 'max:255'],
'slug' => ['required', 'string', 'max:255'],
'description' => ['nullable', 'string'],
'schema' => ['nullable', 'array'],
'enabled' => ['sometimes', 'boolean']]); if ($request->filled('schema_json')) { $data['schema'] = json_decode($request->string('schema_json')->toString(), true, 512, JSON_THROW_ON_ERROR); }
$data['enabled'] = $request->boolean('enabled'); $form->update($data); return redirect()->route('forms.index')->with('status', 'Form updated.'); }
public function destroy(Form $form): RedirectResponse { $form->delete(); return back()->with('status', 'Form deleted.'); }
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace Modules\Forms\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
final class Form extends Model
{
use HasFactory, SoftDeletes;
protected $table = 'forms';
protected $fillable = ['name', 'slug', 'description', 'schema', 'enabled'];
protected function casts(): array { return [
'schema' => 'array',
'enabled' => 'boolean'
]; }
}
@@ -0,0 +1,20 @@
<?php
namespace Modules\Forms\Providers;
use Illuminate\Support\ServiceProvider;
final class FormsServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->register(RouteServiceProvider::class);
$this->mergeConfigFrom(module_path('Forms', 'Config/config.php'), 'forms');
}
public function boot(): void
{
$this->loadMigrationsFrom(module_path('Forms', 'Database/Migrations'));
$this->loadViewsFrom(module_path('Forms', 'Resources/views'), 'forms');
}
}
@@ -0,0 +1,15 @@
<?php
namespace Modules\Forms\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
final class RouteServiceProvider extends ServiceProvider
{
public function boot(): void
{
parent::boot();
$this->routes(fn () => Route::middleware('web')->group(module_path('Forms', 'Routes/web.php')));
}
}
@@ -0,0 +1,9 @@
<x-layouts.app :title="isset($record) ? __('Edit Form') : __('Create Form')">
<div class="mx-auto max-w-4xl space-y-6"><div><h1 class="text-2xl font-semibold">{{ isset($record) ? 'Edit' : 'Create' }} Form</h1></div><form method="POST" action="{{ isset($record) ? route('administration.forms.update', $record) : route('administration.forms.store') }}" class="space-y-5 rounded-xl border border-zinc-200 bg-white p-6 dark:border-zinc-700 dark:bg-zinc-900">@csrf @isset($record) @method('PUT') @endisset
<div><label class="mb-1 block text-sm font-medium">Name</label><input type="text" name="name" value="{{ old('name', $record->name ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('name')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Slug</label><input type="text" name="slug" value="{{ old('slug', $record->slug ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('slug')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Description</label><textarea name="description" rows="4" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">{{ old('description', $record->description ?? '') }}</textarea>@error('description')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Schema (JSON)</label><textarea name="schema_json" rows="6" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">{{ old('schema_json', isset($record) ? json_encode($record->schema, JSON_PRETTY_PRINT) : '') }}</textarea></div>
<label class="flex items-center gap-2"><input type="checkbox" name="enabled" value="1" @checked(old('enabled', $record->enabled ?? true))><span>Enabled</span></label>
<div class="flex gap-3"><button class="rounded-lg bg-zinc-900 px-4 py-2 text-white dark:bg-white dark:text-zinc-900">Save</button><a href="{{ route('administration.forms.index') }}" class="rounded-lg border px-4 py-2">Cancel</a></div></form></div>
</x-layouts.app>
@@ -0,0 +1,5 @@
<x-layouts.app :title="__('Forms')">
<div class="space-y-6"><div class="flex items-center justify-between"><div><h1 class="text-2xl font-semibold">Forms</h1><p class="text-sm text-zinc-500">Manage forms content.</p></div><a href="{{ route('administration.forms.create') }}" class="rounded-lg bg-zinc-900 px-4 py-2 text-sm text-white dark:bg-white dark:text-zinc-900">Add new</a></div>
@if(session('status'))<div class="rounded-lg bg-emerald-50 p-3 text-emerald-800">{{ session('status') }}</div>@endif
<div class="overflow-hidden rounded-xl border border-zinc-200 bg-white dark:border-zinc-700 dark:bg-zinc-900"><table class="w-full text-sm"><thead class="bg-zinc-50 dark:bg-zinc-800"><tr><th class="px-4 py-3 text-left">Name</th><th class="px-4 py-3 text-left">Slug</th><th class="px-4 py-3 text-left">Description</th><th class="px-4 py-3 text-right">Actions</th></tr></thead><tbody class="divide-y divide-zinc-200 dark:divide-zinc-800">@forelse($records as $record)<tr><td class="px-4 py-3">{{ is_array($record->name) ? json_encode($record->name) : Str::limit((string) $record->name, 70) }}</td><td class="px-4 py-3">{{ is_array($record->slug) ? json_encode($record->slug) : Str::limit((string) $record->slug, 70) }}</td><td class="px-4 py-3">{{ is_array($record->description) ? json_encode($record->description) : Str::limit((string) $record->description, 70) }}</td><td class="px-4 py-3 text-right"><a class="mr-3 underline" href="{{ route('administration.forms.edit', $record) }}">Edit</a><form class="inline" method="POST" action="{{ route('administration.forms.destroy', $record) }}">@csrf @method('DELETE')<button class="text-red-600" onclick="return confirm('Delete this record?')">Delete</button></form></td></tr>@empty<tr><td colspan="4" class="px-4 py-10 text-center text-zinc-500">No records yet.</td></tr>@endforelse</tbody></table></div>{{ $records->links() }}</div>
</x-layouts.app>
+8
View File
@@ -0,0 +1,8 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Forms\Http\Controllers\FormController;
Route::middleware(['auth', 'verified'])->prefix('administration/forms')->name('administration.forms.')->group(function (): void {
Route::resource('/', FormController::class)->parameters(['' => 'form'])->except('show');
});
+5
View File
@@ -0,0 +1,5 @@
<?php
namespace Modules\Forms\Support;
final class ModuleInfo { public static function name(): string { return 'Forms'; } public static function nameLower(): string { return 'forms'; } }
@@ -0,0 +1,5 @@
<?php
use Illuminate\Support\Facades\Route;
it('registers the Forms administration route', function (): void { expect(Route::has('administration.forms.index'))->toBeTrue(); });
+20
View File
@@ -0,0 +1,20 @@
{
"name": "Forms",
"alias": "forms",
"version": "1.0.0",
"description": "Forms CMS module.",
"keywords": [
"cms",
"forms"
],
"priority": 24,
"providers": [
"Modules\\Forms\\Providers\\FormsServiceProvider"
],
"aliases": {},
"files": [],
"requires": [
"Core",
"Administration"
]
}
+3
View File
@@ -0,0 +1,3 @@
<?php
return ['name' => 'Menus'];
@@ -0,0 +1,15 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void { Schema::create('menus', function (Blueprint $table): void { $table->id();
$table->string('name');
$table->string('location');
$table->json('items')->nullable();
$table->boolean('enabled')->default(true);
$table->timestamps(); $table->softDeletes(); }); }
public function down(): void { Schema::dropIfExists('menus'); }
};
@@ -0,0 +1,27 @@
<?php
namespace Modules\Menus\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
use Modules\Menus\Models\Menu;
final class MenuController extends Controller
{
public function index(): View { return view('menus::admin.index', ['records' => Menu::query()->latest()->paginate(20)]); }
public function create(): View { return view('menus::admin.form'); }
public function store(Request $request): RedirectResponse { $data = $request->validate(['name' => ['required', 'string', 'max:255'],
'location' => ['required', 'string', 'max:255'],
'items' => ['nullable', 'array'],
'enabled' => ['sometimes', 'boolean']]); if ($request->filled('items_json')) { $data['items'] = json_decode($request->string('items_json')->toString(), true, 512, JSON_THROW_ON_ERROR); }
$data['enabled'] = $request->boolean('enabled'); Menu::create($data); return redirect()->route('menus.index')->with('status', 'Menu created.'); }
public function edit(Menu $menu): View { return view('menus::admin.form', ['record' => $menu]); }
public function update(Request $request, Menu $menu): RedirectResponse { $data = $request->validate(['name' => ['required', 'string', 'max:255'],
'location' => ['required', 'string', 'max:255'],
'items' => ['nullable', 'array'],
'enabled' => ['sometimes', 'boolean']]); if ($request->filled('items_json')) { $data['items'] = json_decode($request->string('items_json')->toString(), true, 512, JSON_THROW_ON_ERROR); }
$data['enabled'] = $request->boolean('enabled'); $menu->update($data); return redirect()->route('menus.index')->with('status', 'Menu updated.'); }
public function destroy(Menu $menu): RedirectResponse { $menu->delete(); return back()->with('status', 'Menu deleted.'); }
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace Modules\Menus\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
final class Menu extends Model
{
use HasFactory, SoftDeletes;
protected $table = 'menus';
protected $fillable = ['name', 'location', 'items', 'enabled'];
protected function casts(): array { return [
'items' => 'array',
'enabled' => 'boolean'
]; }
}
@@ -0,0 +1,20 @@
<?php
namespace Modules\Menus\Providers;
use Illuminate\Support\ServiceProvider;
final class MenusServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->register(RouteServiceProvider::class);
$this->mergeConfigFrom(module_path('Menus', 'Config/config.php'), 'menus');
}
public function boot(): void
{
$this->loadMigrationsFrom(module_path('Menus', 'Database/Migrations'));
$this->loadViewsFrom(module_path('Menus', 'Resources/views'), 'menus');
}
}
@@ -0,0 +1,15 @@
<?php
namespace Modules\Menus\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
final class RouteServiceProvider extends ServiceProvider
{
public function boot(): void
{
parent::boot();
$this->routes(fn () => Route::middleware('web')->group(module_path('Menus', 'Routes/web.php')));
}
}
@@ -0,0 +1,8 @@
<x-layouts.app :title="isset($record) ? __('Edit Menu') : __('Create Menu')">
<div class="mx-auto max-w-4xl space-y-6"><div><h1 class="text-2xl font-semibold">{{ isset($record) ? 'Edit' : 'Create' }} Menu</h1></div><form method="POST" action="{{ isset($record) ? route('administration.menus.update', $record) : route('administration.menus.store') }}" class="space-y-5 rounded-xl border border-zinc-200 bg-white p-6 dark:border-zinc-700 dark:bg-zinc-900">@csrf @isset($record) @method('PUT') @endisset
<div><label class="mb-1 block text-sm font-medium">Name</label><input type="text" name="name" value="{{ old('name', $record->name ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('name')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Location</label><input type="text" name="location" value="{{ old('location', $record->location ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('location')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Items (JSON)</label><textarea name="items_json" rows="6" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">{{ old('items_json', isset($record) ? json_encode($record->items, JSON_PRETTY_PRINT) : '') }}</textarea></div>
<label class="flex items-center gap-2"><input type="checkbox" name="enabled" value="1" @checked(old('enabled', $record->enabled ?? true))><span>Enabled</span></label>
<div class="flex gap-3"><button class="rounded-lg bg-zinc-900 px-4 py-2 text-white dark:bg-white dark:text-zinc-900">Save</button><a href="{{ route('administration.menus.index') }}" class="rounded-lg border px-4 py-2">Cancel</a></div></form></div>
</x-layouts.app>
@@ -0,0 +1,5 @@
<x-layouts.app :title="__('Menus')">
<div class="space-y-6"><div class="flex items-center justify-between"><div><h1 class="text-2xl font-semibold">Menus</h1><p class="text-sm text-zinc-500">Manage menus content.</p></div><a href="{{ route('administration.menus.create') }}" class="rounded-lg bg-zinc-900 px-4 py-2 text-sm text-white dark:bg-white dark:text-zinc-900">Add new</a></div>
@if(session('status'))<div class="rounded-lg bg-emerald-50 p-3 text-emerald-800">{{ session('status') }}</div>@endif
<div class="overflow-hidden rounded-xl border border-zinc-200 bg-white dark:border-zinc-700 dark:bg-zinc-900"><table class="w-full text-sm"><thead class="bg-zinc-50 dark:bg-zinc-800"><tr><th class="px-4 py-3 text-left">Name</th><th class="px-4 py-3 text-left">Location</th><th class="px-4 py-3 text-left">Items</th><th class="px-4 py-3 text-right">Actions</th></tr></thead><tbody class="divide-y divide-zinc-200 dark:divide-zinc-800">@forelse($records as $record)<tr><td class="px-4 py-3">{{ is_array($record->name) ? json_encode($record->name) : Str::limit((string) $record->name, 70) }}</td><td class="px-4 py-3">{{ is_array($record->location) ? json_encode($record->location) : Str::limit((string) $record->location, 70) }}</td><td class="px-4 py-3">{{ is_array($record->items) ? json_encode($record->items) : Str::limit((string) $record->items, 70) }}</td><td class="px-4 py-3 text-right"><a class="mr-3 underline" href="{{ route('administration.menus.edit', $record) }}">Edit</a><form class="inline" method="POST" action="{{ route('administration.menus.destroy', $record) }}">@csrf @method('DELETE')<button class="text-red-600" onclick="return confirm('Delete this record?')">Delete</button></form></td></tr>@empty<tr><td colspan="4" class="px-4 py-10 text-center text-zinc-500">No records yet.</td></tr>@endforelse</tbody></table></div>{{ $records->links() }}</div>
</x-layouts.app>
+8
View File
@@ -0,0 +1,8 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Menus\Http\Controllers\MenuController;
Route::middleware(['auth', 'verified'])->prefix('administration/menus')->name('administration.menus.')->group(function (): void {
Route::resource('/', MenuController::class)->parameters(['' => 'menu'])->except('show');
});
+5
View File
@@ -0,0 +1,5 @@
<?php
namespace Modules\Menus\Support;
final class ModuleInfo { public static function name(): string { return 'Menus'; } public static function nameLower(): string { return 'menus'; } }
@@ -0,0 +1,5 @@
<?php
use Illuminate\Support\Facades\Route;
it('registers the Menus administration route', function (): void { expect(Route::has('administration.menus.index'))->toBeTrue(); });
+20
View File
@@ -0,0 +1,20 @@
{
"name": "Menus",
"alias": "menus",
"version": "1.0.0",
"description": "Menus CMS module.",
"keywords": [
"cms",
"menus"
],
"priority": 22,
"providers": [
"Modules\\Menus\\Providers\\MenusServiceProvider"
],
"aliases": {},
"files": [],
"requires": [
"Core",
"Administration"
]
}
+3
View File
@@ -0,0 +1,3 @@
<?php
return ['name' => 'Pages'];
@@ -0,0 +1,18 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void { Schema::create('pages', function (Blueprint $table): void { $table->id();
$table->string('title');
$table->string('slug');
$table->text('summary')->nullable();
$table->longText('content')->nullable();
$table->string('status')->default('draft');
$table->timestamp('published_at')->nullable();
$table->boolean('is_home')->default(false);
$table->timestamps(); $table->softDeletes(); }); }
public function down(): void { Schema::dropIfExists('pages'); }
};
@@ -0,0 +1,31 @@
<?php
namespace Modules\Pages\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
use Modules\Pages\Models\Page;
final class PageController extends Controller
{
public function index(): View { return view('pages::admin.index', ['records' => Page::query()->latest()->paginate(20)]); }
public function create(): View { return view('pages::admin.form'); }
public function store(Request $request): RedirectResponse { $data = $request->validate(['title' => ['required', 'string', 'max:255'],
'slug' => ['required', 'string', 'max:255'],
'summary' => ['nullable', 'string'],
'content' => ['nullable', 'string'],
'status' => ['required', 'string', 'max:255'],
'published_at' => ['nullable', 'date'],
'is_home' => ['sometimes', 'boolean']]); $data['is_home'] = $request->boolean('is_home'); Page::create($data); return redirect()->route('pages.index')->with('status', 'Page created.'); }
public function edit(Page $page): View { return view('pages::admin.form', ['record' => $page]); }
public function update(Request $request, Page $page): RedirectResponse { $data = $request->validate(['title' => ['required', 'string', 'max:255'],
'slug' => ['required', 'string', 'max:255'],
'summary' => ['nullable', 'string'],
'content' => ['nullable', 'string'],
'status' => ['required', 'string', 'max:255'],
'published_at' => ['nullable', 'date'],
'is_home' => ['sometimes', 'boolean']]); $data['is_home'] = $request->boolean('is_home'); $page->update($data); return redirect()->route('pages.index')->with('status', 'Page updated.'); }
public function destroy(Page $page): RedirectResponse { $page->delete(); return back()->with('status', 'Page deleted.'); }
}
@@ -0,0 +1,6 @@
<?php
namespace Modules\Pages\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\View\View;
use Modules\Pages\Models\Page;
final class PublicPageController extends Controller { public function show(string $slug): View { $page=Page::query()->where('slug',$slug)->where('status','published')->where(fn($q)=>$q->whereNull('published_at')->orWhere('published_at','<=',now()))->firstOrFail(); return view('pages::public.show',compact('page')); } }
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace Modules\Pages\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
final class Page extends Model
{
use HasFactory, SoftDeletes;
protected $table = 'pages';
protected $fillable = ['title', 'slug', 'summary', 'content', 'status', 'published_at', 'is_home'];
protected function casts(): array { return [
'published_at' => 'datetime',
'is_home' => 'boolean'
]; }
}
@@ -0,0 +1,20 @@
<?php
namespace Modules\Pages\Providers;
use Illuminate\Support\ServiceProvider;
final class PagesServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->register(RouteServiceProvider::class);
$this->mergeConfigFrom(module_path('Pages', 'Config/config.php'), 'pages');
}
public function boot(): void
{
$this->loadMigrationsFrom(module_path('Pages', 'Database/Migrations'));
$this->loadViewsFrom(module_path('Pages', 'Resources/views'), 'pages');
}
}
@@ -0,0 +1,15 @@
<?php
namespace Modules\Pages\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
final class RouteServiceProvider extends ServiceProvider
{
public function boot(): void
{
parent::boot();
$this->routes(fn () => Route::middleware('web')->group(module_path('Pages', 'Routes/web.php')));
}
}
@@ -0,0 +1,11 @@
<x-layouts.app :title="isset($record) ? __('Edit Page') : __('Create Page')">
<div class="mx-auto max-w-4xl space-y-6"><div><h1 class="text-2xl font-semibold">{{ isset($record) ? 'Edit' : 'Create' }} Page</h1></div><form method="POST" action="{{ isset($record) ? route('administration.pages.update', $record) : route('administration.pages.store') }}" class="space-y-5 rounded-xl border border-zinc-200 bg-white p-6 dark:border-zinc-700 dark:bg-zinc-900">@csrf @isset($record) @method('PUT') @endisset
<div><label class="mb-1 block text-sm font-medium">Title</label><input type="text" name="title" value="{{ old('title', $record->title ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('title')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Slug</label><input type="text" name="slug" value="{{ old('slug', $record->slug ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('slug')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Summary</label><textarea name="summary" rows="4" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">{{ old('summary', $record->summary ?? '') }}</textarea>@error('summary')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Content</label><textarea name="content" rows="8" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">{{ old('content', $record->content ?? '') }}</textarea>@error('content')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Status</label><input type="text" name="status" value="{{ old('status', $record->status ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('status')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Published At</label><input type="datetime-local" name="published_at" value="{{ old('published_at', $record->published_at ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('published_at')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<label class="flex items-center gap-2"><input type="checkbox" name="is_home" value="1" @checked(old('is_home', $record->is_home ?? false))><span>Is Home</span></label>
<div class="flex gap-3"><button class="rounded-lg bg-zinc-900 px-4 py-2 text-white dark:bg-white dark:text-zinc-900">Save</button><a href="{{ route('administration.pages.index') }}" class="rounded-lg border px-4 py-2">Cancel</a></div></form></div>
</x-layouts.app>
@@ -0,0 +1,5 @@
<x-layouts.app :title="__('Pages')">
<div class="space-y-6"><div class="flex items-center justify-between"><div><h1 class="text-2xl font-semibold">Pages</h1><p class="text-sm text-zinc-500">Manage pages content.</p></div><a href="{{ route('administration.pages.create') }}" class="rounded-lg bg-zinc-900 px-4 py-2 text-sm text-white dark:bg-white dark:text-zinc-900">Add new</a></div>
@if(session('status'))<div class="rounded-lg bg-emerald-50 p-3 text-emerald-800">{{ session('status') }}</div>@endif
<div class="overflow-hidden rounded-xl border border-zinc-200 bg-white dark:border-zinc-700 dark:bg-zinc-900"><table class="w-full text-sm"><thead class="bg-zinc-50 dark:bg-zinc-800"><tr><th class="px-4 py-3 text-left">Title</th><th class="px-4 py-3 text-left">Slug</th><th class="px-4 py-3 text-left">Summary</th><th class="px-4 py-3 text-right">Actions</th></tr></thead><tbody class="divide-y divide-zinc-200 dark:divide-zinc-800">@forelse($records as $record)<tr><td class="px-4 py-3">{{ is_array($record->title) ? json_encode($record->title) : Str::limit((string) $record->title, 70) }}</td><td class="px-4 py-3">{{ is_array($record->slug) ? json_encode($record->slug) : Str::limit((string) $record->slug, 70) }}</td><td class="px-4 py-3">{{ is_array($record->summary) ? json_encode($record->summary) : Str::limit((string) $record->summary, 70) }}</td><td class="px-4 py-3 text-right"><a class="mr-3 underline" href="{{ route('administration.pages.edit', $record) }}">Edit</a><form class="inline" method="POST" action="{{ route('administration.pages.destroy', $record) }}">@csrf @method('DELETE')<button class="text-red-600" onclick="return confirm('Delete this record?')">Delete</button></form></td></tr>@empty<tr><td colspan="4" class="px-4 py-10 text-center text-zinc-500">No records yet.</td></tr>@endforelse</tbody></table></div>{{ $records->links() }}</div>
</x-layouts.app>
@@ -0,0 +1 @@
<x-layouts.app :title="$page->title"><article class="prose mx-auto max-w-4xl py-10 dark:prose-invert"><h1>{{ $page->title }}</h1>@if($page->summary)<p class="lead">{{ $page->summary }}</p>@endif{!! $page->content !!}</article></x-layouts.app>
+10
View File
@@ -0,0 +1,10 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Pages\Http\Controllers\PageController;
Route::middleware(['auth', 'verified'])->prefix('administration/pages')->name('administration.pages.')->group(function (): void {
Route::resource('/', PageController::class)->parameters(['' => 'page'])->except('show');
});
Route::get('/pages/{slug}', [Modules\Pages\Http\Controllers\PublicPageController::class, 'show'])->name('pages.public.show');
+5
View File
@@ -0,0 +1,5 @@
<?php
namespace Modules\Pages\Support;
final class ModuleInfo { public static function name(): string { return 'Pages'; } public static function nameLower(): string { return 'pages'; } }
@@ -0,0 +1,5 @@
<?php
use Illuminate\Support\Facades\Route;
it('registers the Pages administration route', function (): void { expect(Route::has('administration.pages.index'))->toBeTrue(); });
+20
View File
@@ -0,0 +1,20 @@
{
"name": "Pages",
"alias": "pages",
"version": "1.0.0",
"description": "Pages CMS module.",
"keywords": [
"cms",
"pages"
],
"priority": 21,
"providers": [
"Modules\\Pages\\Providers\\PagesServiceProvider"
],
"aliases": {},
"files": [],
"requires": [
"Core",
"Administration"
]
}
+3
View File
@@ -0,0 +1,3 @@
<?php
return ['name' => 'Redirects'];
@@ -0,0 +1,15 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void { Schema::create('redirects', function (Blueprint $table): void { $table->id();
$table->string('source');
$table->string('destination');
$table->unsignedInteger('status_code')->default(301);
$table->boolean('enabled')->default(true);
$table->timestamps(); $table->softDeletes(); }); }
public function down(): void { Schema::dropIfExists('redirects'); }
};
@@ -0,0 +1,25 @@
<?php
namespace Modules\Redirects\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
use Modules\Redirects\Models\Redirect;
final class RedirectController extends Controller
{
public function index(): View { return view('redirects::admin.index', ['records' => Redirect::query()->latest()->paginate(20)]); }
public function create(): View { return view('redirects::admin.form'); }
public function store(Request $request): RedirectResponse { $data = $request->validate(['source' => ['required', 'string', 'max:255'],
'destination' => ['required', 'string', 'max:255'],
'status_code' => ['nullable', 'integer', 'min:0'],
'enabled' => ['sometimes', 'boolean']]); $data['enabled'] = $request->boolean('enabled'); Redirect::create($data); return redirect()->route('redirects.index')->with('status', 'Redirect created.'); }
public function edit(Redirect $redirect): View { return view('redirects::admin.form', ['record' => $redirect]); }
public function update(Request $request, Redirect $redirect): RedirectResponse { $data = $request->validate(['source' => ['required', 'string', 'max:255'],
'destination' => ['required', 'string', 'max:255'],
'status_code' => ['nullable', 'integer', 'min:0'],
'enabled' => ['sometimes', 'boolean']]); $data['enabled'] = $request->boolean('enabled'); $redirect->update($data); return redirect()->route('redirects.index')->with('status', 'Redirect updated.'); }
public function destroy(Redirect $redirect): RedirectResponse { $redirect->delete(); return back()->with('status', 'Redirect deleted.'); }
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace Modules\Redirects\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
final class Redirect extends Model
{
use HasFactory, SoftDeletes;
protected $table = 'redirects';
protected $fillable = ['source', 'destination', 'status_code', 'enabled'];
protected function casts(): array { return [
'status_code' => 'integer',
'enabled' => 'boolean'
]; }
}
@@ -0,0 +1,20 @@
<?php
namespace Modules\Redirects\Providers;
use Illuminate\Support\ServiceProvider;
final class RedirectsServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->register(RouteServiceProvider::class);
$this->mergeConfigFrom(module_path('Redirects', 'Config/config.php'), 'redirects');
}
public function boot(): void
{
$this->loadMigrationsFrom(module_path('Redirects', 'Database/Migrations'));
$this->loadViewsFrom(module_path('Redirects', 'Resources/views'), 'redirects');
}
}
@@ -0,0 +1,15 @@
<?php
namespace Modules\Redirects\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
final class RouteServiceProvider extends ServiceProvider
{
public function boot(): void
{
parent::boot();
$this->routes(fn () => Route::middleware('web')->group(module_path('Redirects', 'Routes/web.php')));
}
}
@@ -0,0 +1,8 @@
<x-layouts.app :title="isset($record) ? __('Edit Redirect') : __('Create Redirect')">
<div class="mx-auto max-w-4xl space-y-6"><div><h1 class="text-2xl font-semibold">{{ isset($record) ? 'Edit' : 'Create' }} Redirect</h1></div><form method="POST" action="{{ isset($record) ? route('administration.redirects.update', $record) : route('administration.redirects.store') }}" class="space-y-5 rounded-xl border border-zinc-200 bg-white p-6 dark:border-zinc-700 dark:bg-zinc-900">@csrf @isset($record) @method('PUT') @endisset
<div><label class="mb-1 block text-sm font-medium">Source</label><input type="text" name="source" value="{{ old('source', $record->source ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('source')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Destination</label><input type="text" name="destination" value="{{ old('destination', $record->destination ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('destination')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Status Code</label><input type="number" name="status_code" value="{{ old('status_code', $record->status_code ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('status_code')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<label class="flex items-center gap-2"><input type="checkbox" name="enabled" value="1" @checked(old('enabled', $record->enabled ?? true))><span>Enabled</span></label>
<div class="flex gap-3"><button class="rounded-lg bg-zinc-900 px-4 py-2 text-white dark:bg-white dark:text-zinc-900">Save</button><a href="{{ route('administration.redirects.index') }}" class="rounded-lg border px-4 py-2">Cancel</a></div></form></div>
</x-layouts.app>
@@ -0,0 +1,5 @@
<x-layouts.app :title="__('Redirects')">
<div class="space-y-6"><div class="flex items-center justify-between"><div><h1 class="text-2xl font-semibold">Redirects</h1><p class="text-sm text-zinc-500">Manage redirects content.</p></div><a href="{{ route('administration.redirects.create') }}" class="rounded-lg bg-zinc-900 px-4 py-2 text-sm text-white dark:bg-white dark:text-zinc-900">Add new</a></div>
@if(session('status'))<div class="rounded-lg bg-emerald-50 p-3 text-emerald-800">{{ session('status') }}</div>@endif
<div class="overflow-hidden rounded-xl border border-zinc-200 bg-white dark:border-zinc-700 dark:bg-zinc-900"><table class="w-full text-sm"><thead class="bg-zinc-50 dark:bg-zinc-800"><tr><th class="px-4 py-3 text-left">Source</th><th class="px-4 py-3 text-left">Destination</th><th class="px-4 py-3 text-left">Status Code</th><th class="px-4 py-3 text-right">Actions</th></tr></thead><tbody class="divide-y divide-zinc-200 dark:divide-zinc-800">@forelse($records as $record)<tr><td class="px-4 py-3">{{ is_array($record->source) ? json_encode($record->source) : Str::limit((string) $record->source, 70) }}</td><td class="px-4 py-3">{{ is_array($record->destination) ? json_encode($record->destination) : Str::limit((string) $record->destination, 70) }}</td><td class="px-4 py-3">{{ is_array($record->status_code) ? json_encode($record->status_code) : Str::limit((string) $record->status_code, 70) }}</td><td class="px-4 py-3 text-right"><a class="mr-3 underline" href="{{ route('administration.redirects.edit', $record) }}">Edit</a><form class="inline" method="POST" action="{{ route('administration.redirects.destroy', $record) }}">@csrf @method('DELETE')<button class="text-red-600" onclick="return confirm('Delete this record?')">Delete</button></form></td></tr>@empty<tr><td colspan="4" class="px-4 py-10 text-center text-zinc-500">No records yet.</td></tr>@endforelse</tbody></table></div>{{ $records->links() }}</div>
</x-layouts.app>
+8
View File
@@ -0,0 +1,8 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Redirects\Http\Controllers\RedirectController;
Route::middleware(['auth', 'verified'])->prefix('administration/redirects')->name('administration.redirects.')->group(function (): void {
Route::resource('/', RedirectController::class)->parameters(['' => 'redirect'])->except('show');
});
+5
View File
@@ -0,0 +1,5 @@
<?php
namespace Modules\Redirects\Support;
final class ModuleInfo { public static function name(): string { return 'Redirects'; } public static function nameLower(): string { return 'redirects'; } }
@@ -0,0 +1,5 @@
<?php
use Illuminate\Support\Facades\Route;
it('registers the Redirects administration route', function (): void { expect(Route::has('administration.redirects.index'))->toBeTrue(); });
+20
View File
@@ -0,0 +1,20 @@
{
"name": "Redirects",
"alias": "redirects",
"version": "1.0.0",
"description": "Redirects CMS module.",
"keywords": [
"cms",
"redirects"
],
"priority": 23,
"providers": [
"Modules\\Redirects\\Providers\\RedirectsServiceProvider"
],
"aliases": {},
"files": [],
"requires": [
"Core",
"Administration"
]
}
@@ -30,6 +30,15 @@ final class RolePermissionSeeder extends Seeder
'seo.manage',
'search.manage',
'themes.manage',
'pages.manage',
'menus.manage',
'redirects.manage',
'forms.manage',
'documents.manage',
'banners.manage',
'faq.manage',
'team.manage',
'testimonials.manage',
];
foreach ($permissions as $permission) {
+3
View File
@@ -0,0 +1,3 @@
<?php
return ['name' => 'Team'];
@@ -0,0 +1,17 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
public function up(): void { Schema::create('team_members', function (Blueprint $table): void { $table->id();
$table->string('name');
$table->string('job_title')->nullable();
$table->text('biography')->nullable();
$table->string('email')->nullable();
$table->unsignedInteger('sort_order')->default(0);
$table->boolean('enabled')->default(true);
$table->timestamps(); $table->softDeletes(); }); }
public function down(): void { Schema::dropIfExists('team_members'); }
};
@@ -0,0 +1,29 @@
<?php
namespace Modules\Team\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\View\View;
use Modules\Team\Models\TeamMember;
final class TeamMemberController extends Controller
{
public function index(): View { return view('team::admin.index', ['records' => TeamMember::query()->latest()->paginate(20)]); }
public function create(): View { return view('team::admin.form'); }
public function store(Request $request): RedirectResponse { $data = $request->validate(['name' => ['required', 'string', 'max:255'],
'job_title' => ['nullable', 'string'],
'biography' => ['nullable', 'string'],
'email' => ['nullable', 'string'],
'sort_order' => ['nullable', 'integer', 'min:0'],
'enabled' => ['sometimes', 'boolean']]); $data['enabled'] = $request->boolean('enabled'); TeamMember::create($data); return redirect()->route('team.index')->with('status', 'TeamMember created.'); }
public function edit(TeamMember $teamMember): View { return view('team::admin.form', ['record' => $teamMember]); }
public function update(Request $request, TeamMember $teamMember): RedirectResponse { $data = $request->validate(['name' => ['required', 'string', 'max:255'],
'job_title' => ['nullable', 'string'],
'biography' => ['nullable', 'string'],
'email' => ['nullable', 'string'],
'sort_order' => ['nullable', 'integer', 'min:0'],
'enabled' => ['sometimes', 'boolean']]); $data['enabled'] = $request->boolean('enabled'); $teamMember->update($data); return redirect()->route('team.index')->with('status', 'TeamMember updated.'); }
public function destroy(TeamMember $teamMember): RedirectResponse { $teamMember->delete(); return back()->with('status', 'TeamMember deleted.'); }
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace Modules\Team\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
final class TeamMember extends Model
{
use HasFactory, SoftDeletes;
protected $table = 'team_members';
protected $fillable = ['name', 'job_title', 'biography', 'email', 'sort_order', 'enabled'];
protected function casts(): array { return [
'sort_order' => 'integer',
'enabled' => 'boolean'
]; }
}
@@ -0,0 +1,15 @@
<?php
namespace Modules\Team\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
final class RouteServiceProvider extends ServiceProvider
{
public function boot(): void
{
parent::boot();
$this->routes(fn () => Route::middleware('web')->group(module_path('Team', 'Routes/web.php')));
}
}
@@ -0,0 +1,20 @@
<?php
namespace Modules\Team\Providers;
use Illuminate\Support\ServiceProvider;
final class TeamServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->register(RouteServiceProvider::class);
$this->mergeConfigFrom(module_path('Team', 'Config/config.php'), 'team');
}
public function boot(): void
{
$this->loadMigrationsFrom(module_path('Team', 'Database/Migrations'));
$this->loadViewsFrom(module_path('Team', 'Resources/views'), 'team');
}
}
@@ -0,0 +1,10 @@
<x-layouts.app :title="isset($record) ? __('Edit TeamMember') : __('Create TeamMember')">
<div class="mx-auto max-w-4xl space-y-6"><div><h1 class="text-2xl font-semibold">{{ isset($record) ? 'Edit' : 'Create' }} Team member</h1></div><form method="POST" action="{{ isset($record) ? route('administration.team.update', $record) : route('administration.team.store') }}" class="space-y-5 rounded-xl border border-zinc-200 bg-white p-6 dark:border-zinc-700 dark:bg-zinc-900">@csrf @isset($record) @method('PUT') @endisset
<div><label class="mb-1 block text-sm font-medium">Name</label><input type="text" name="name" value="{{ old('name', $record->name ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('name')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Job Title</label><input type="text" name="job_title" value="{{ old('job_title', $record->job_title ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('job_title')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Biography</label><textarea name="biography" rows="4" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">{{ old('biography', $record->biography ?? '') }}</textarea>@error('biography')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Email</label><input type="text" name="email" value="{{ old('email', $record->email ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('email')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<div><label class="mb-1 block text-sm font-medium">Sort Order</label><input type="number" name="sort_order" value="{{ old('sort_order', $record->sort_order ?? '') }}" class="w-full rounded-lg border-zinc-300 dark:border-zinc-700 dark:bg-zinc-900">@error('sort_order')<p class="text-sm text-red-600">{{ $message }}</p>@enderror</div>
<label class="flex items-center gap-2"><input type="checkbox" name="enabled" value="1" @checked(old('enabled', $record->enabled ?? true))><span>Enabled</span></label>
<div class="flex gap-3"><button class="rounded-lg bg-zinc-900 px-4 py-2 text-white dark:bg-white dark:text-zinc-900">Save</button><a href="{{ route('administration.team.index') }}" class="rounded-lg border px-4 py-2">Cancel</a></div></form></div>
</x-layouts.app>
@@ -0,0 +1,5 @@
<x-layouts.app :title="__('Team')">
<div class="space-y-6"><div class="flex items-center justify-between"><div><h1 class="text-2xl font-semibold">Team</h1><p class="text-sm text-zinc-500">Manage team content.</p></div><a href="{{ route('administration.team.create') }}" class="rounded-lg bg-zinc-900 px-4 py-2 text-sm text-white dark:bg-white dark:text-zinc-900">Add new</a></div>
@if(session('status'))<div class="rounded-lg bg-emerald-50 p-3 text-emerald-800">{{ session('status') }}</div>@endif
<div class="overflow-hidden rounded-xl border border-zinc-200 bg-white dark:border-zinc-700 dark:bg-zinc-900"><table class="w-full text-sm"><thead class="bg-zinc-50 dark:bg-zinc-800"><tr><th class="px-4 py-3 text-left">Name</th><th class="px-4 py-3 text-left">Job Title</th><th class="px-4 py-3 text-left">Biography</th><th class="px-4 py-3 text-right">Actions</th></tr></thead><tbody class="divide-y divide-zinc-200 dark:divide-zinc-800">@forelse($records as $record)<tr><td class="px-4 py-3">{{ is_array($record->name) ? json_encode($record->name) : Str::limit((string) $record->name, 70) }}</td><td class="px-4 py-3">{{ is_array($record->job_title) ? json_encode($record->job_title) : Str::limit((string) $record->job_title, 70) }}</td><td class="px-4 py-3">{{ is_array($record->biography) ? json_encode($record->biography) : Str::limit((string) $record->biography, 70) }}</td><td class="px-4 py-3 text-right"><a class="mr-3 underline" href="{{ route('administration.team.edit', $record) }}">Edit</a><form class="inline" method="POST" action="{{ route('administration.team.destroy', $record) }}">@csrf @method('DELETE')<button class="text-red-600" onclick="return confirm('Delete this record?')">Delete</button></form></td></tr>@empty<tr><td colspan="4" class="px-4 py-10 text-center text-zinc-500">No records yet.</td></tr>@endforelse</tbody></table></div>{{ $records->links() }}</div>
</x-layouts.app>
+8
View File
@@ -0,0 +1,8 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Team\Http\Controllers\TeamMemberController;
Route::middleware(['auth', 'verified'])->prefix('administration/team')->name('administration.team.')->group(function (): void {
Route::resource('/', TeamMemberController::class)->parameters(['' => 'teamMember'])->except('show');
});
+5
View File
@@ -0,0 +1,5 @@
<?php
namespace Modules\Team\Support;
final class ModuleInfo { public static function name(): string { return 'Team'; } public static function nameLower(): string { return 'team'; } }
@@ -0,0 +1,5 @@
<?php
use Illuminate\Support\Facades\Route;
it('registers the Team administration route', function (): void { expect(Route::has('administration.team.index'))->toBeTrue(); });
+20
View File
@@ -0,0 +1,20 @@
{
"name": "Team",
"alias": "team",
"version": "1.0.0",
"description": "Team CMS module.",
"keywords": [
"cms",
"team"
],
"priority": 28,
"providers": [
"Modules\\Team\\Providers\\TeamServiceProvider"
],
"aliases": {},
"files": [],
"requires": [
"Core",
"Administration"
]
}
+3
View File
@@ -0,0 +1,3 @@
<?php
return ['name' => 'Testimonials'];

Some files were not shown because too many files have changed in this diff Show More