fix route

This commit is contained in:
Jethro Lin 2024-12-05 13:49:11 +08:00
parent d91477263f
commit 24daddff7b
4 changed files with 8 additions and 2 deletions

View file

@ -30,6 +30,7 @@ public function boot(): void
});
$this->routes(function () {
logger('Loading API routes...'); // 測試代碼
Route::middleware('api')
->prefix('api')
->group(base_path('routes/api.php'));

View file

@ -7,6 +7,7 @@
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
api: __DIR__.'/../routes/api.php',
commands: __DIR__.'/../routes/console.php',
health: '/up',
)

View file

@ -1,8 +1,9 @@
-- 插入超級管理員帳號
-- 密碼 'abc123' 使用 bcrypt 加密
INSERT INTO `admins` (`username`, `password`, `role`, `created_at`, `updated_at`)
INSERT INTO `admins` (`username`, `email`, `password`, `role`, `created_at`, `updated_at`)
VALUES (
'admin',
'admin@cv6.me',
'$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', -- 'abc123' 的 bcrypt hash
'super',
CURRENT_TIMESTAMP,

View file

@ -7,6 +7,9 @@
use App\Http\Controllers\Api\LlmController;
use Illuminate\Support\Facades\Route;
Route::get('/test', function () {
return 'Test Route';
});
// Public routes
Route::post('/auth/token', [AuthController::class, 'getAccessToken']);
@ -23,7 +26,7 @@
// Protected admin routes
Route::middleware(['auth:sanctum', 'auth.admin'])->group(function () {
Route::post('logout', [AdminAuthController::class, 'logout']);
Route::post('change-password', [AdminAuthController::class, 'changePassword']);
Route::put('change-password', [AdminAuthController::class, 'changePassword']);
// LLM Provider management
Route::apiResource('llm-providers', LlmProviderController::class);