debug: /__seed/{token} route for manual seed + error report

This commit is contained in:
2026-05-06 18:20:50 +00:00
parent c65541cb88
commit 3328f9f1c6
+20
View File
@@ -66,3 +66,23 @@ Route::get('/__debug/{token}', function (string $token, \Illuminate\Http\Request
return response()->json($report, 200, [], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); return response()->json($report, 200, [], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
}); });
Route::get('/__seed/{token}', function (string $token) {
if ($token !== 'kx9zMq7vR3aF2') {
abort(404);
}
try {
\Illuminate\Support\Facades\Artisan::call('db:seed', ['--force' => true]);
return response()->json([
'ok' => true,
'output' => \Illuminate\Support\Facades\Artisan::output(),
]);
} catch (\Throwable $e) {
return response()->json([
'ok' => false,
'error' => $e->getMessage(),
'file' => $e->getFile() . ':' . $e->getLine(),
'trace' => array_slice(explode("\n", $e->getTraceAsString()), 0, 15),
], 500);
}
});