feat: 初始化知识库系统项目
- 实现基于 Laravel 11 和 Filament 3.X 的文档管理系统 - 添加用户认证和分组管理功能 - 实现文档上传、分类和权限控制 - 集成 Word 文档自动转换为 Markdown - 集成 Meilisearch 全文搜索引擎 - 实现文档在线预览功能 - 添加安全日志和审计功能 - 完整的简体中文界面 - 包含完整的项目文档和部署指南 技术栈: - Laravel 11.x - Filament 3.X - Meilisearch 1.5+ - Pandoc 文档转换 - Redis 队列系统 - Pest PHP 测试框架
This commit is contained in:
8
routes/console.php
Normal file
8
routes/console.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
33
routes/web.php
Normal file
33
routes/web.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\DocumentController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
|
||||
// 文档预览和下载路由(需要认证)
|
||||
Route::middleware(['auth'])->group(function () {
|
||||
Route::get('/documents/{document}/preview', [DocumentController::class, 'preview'])
|
||||
->name('documents.preview');
|
||||
Route::get('/documents/{document}/download', [DocumentController::class, 'download'])
|
||||
->name('documents.download');
|
||||
});
|
||||
|
||||
// 提供 markdown 目录中 media 文件的访问(需要认证)
|
||||
// 路径格式: /markdown/{path}/media/{filename}
|
||||
// 其中 path 可以是: 2025/12/04/{uuid} 或 {uuid}
|
||||
Route::middleware(['auth'])->get('/markdown/{path}/media/{filename}', function ($path, $filename) {
|
||||
// 构建完整路径
|
||||
$fullPath = $path . '/media/' . $filename;
|
||||
|
||||
if (!Storage::disk('markdown')->exists($fullPath)) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$file = Storage::disk('markdown')->get($fullPath);
|
||||
$mimeType = Storage::disk('markdown')->mimeType($fullPath);
|
||||
|
||||
return response($file, 200)->header('Content-Type', $mimeType);
|
||||
})->where('path', '.*')->where('filename', '[^/]+')->name('markdown.media');
|
||||
Reference in New Issue
Block a user