style updates

This commit is contained in:
Mark Gregory
2026-07-24 14:59:44 +01:00
parent 24ab771cd3
commit dd23205d0b
482 changed files with 7173 additions and 1435 deletions
@@ -4,12 +4,23 @@ 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();
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'); }
$table->timestamps();
$table->softDeletes();
});
}
public function down(): void
{
Schema::dropIfExists('documents');
}
};
@@ -10,16 +10,49 @@ 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'],
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'],
'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.'); }
'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.');
}
}
+10 -6
View File
@@ -9,11 +9,15 @@ 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'
]; }
protected $table = 'documents';
protected $fillable = ['title', 'description', 'file_path', 'is_public'];
protected function casts(): array
{
return [
'is_public' => 'boolean',
];
}
}
+12 -1
View File
@@ -2,4 +2,15 @@
namespace Modules\Documents\Support;
final class ModuleInfo { public static function name(): string { return 'Documents'; } public static function nameLower(): string { return 'documents'; } }
final class ModuleInfo
{
public static function name(): string
{
return 'Documents';
}
public static function nameLower(): string
{
return 'documents';
}
}
@@ -2,4 +2,6 @@
use Illuminate\Support\Facades\Route;
it('registers the Documents administration route', function (): void { expect(Route::has('administration.documents.index'))->toBeTrue(); });
it('registers the Documents administration route', function (): void {
expect(Route::has('administration.documents.index'))->toBeTrue();
});