3.0 KiB
3.0 KiB
task, cycles, context, private, started, finished
| task | cycles | context | private | started | finished |
|---|---|---|---|---|---|
| Fix GET /api/public/landing-page returning HTTP 500 — wrong response helper + pending migration | 3 | true | false | 2026-05-16T15:59:26Z | 2026-05-16T16:00:00Z |
files
- app/Http/Controllers/Admin/LandingPageController.php [lines 241-262] — uses
response()->json()instead ofResponse::json()facade; also the only public (no-auth) method in the controller - database/migrations/2026_04_11_000001_create_landing_pages_table.php — migration may not have been run on production; if
landing_pagestable is absent the query throws and returns 500 - routes/web.php [line 689] —
Route::get('/api/public/landing-page', ...)— no middleware, correctly public
steps
- In
LandingPageController::getActiveLandingPage()replace bothresponse()->json([...])calls withResponse::json([...])using the Hypervel facade (use Hypervel\Support\Facades\Response;is already imported at the top of the file — add it if missing). - Add a
try/catcharoundLandingPage::getActive()so a missing table or DB error returns a graceful{"success":false,"message":"..."}500 instead of the bare Server Error page, until the migration is confirmed run. - Confirm (or trigger via Ultimate Console → Migrate button, or
php artisan migrate --forcein the container) that thelanding_pagesmigration has been applied on production.
context
// BROKEN — uses Laravel global helper response() which may not exist / behave differently in Hypervel:
public function getActiveLandingPage()
{
$page = LandingPage::getActive();
if (!$page) {
return response()->json([...]); // <-- wrong helper
}
return response()->json([...]); // <-- wrong helper
}
// FIX — use Hypervel facade:
use Hypervel\Support\Facades\Response;
public function getActiveLandingPage()
{
try {
$page = LandingPage::getActive();
} catch (\Throwable $e) {
return Response::json(['success' => false, 'data' => null, 'has_landing_page' => false]);
}
if (!$page) {
return Response::json(['success' => true, 'data' => null, 'has_landing_page' => false]);
}
return Response::json([
'success' => true,
'data' => ['title' => $page->title, 'html_content' => $page->html_content, 'description' => $page->description],
'has_landing_page' => true,
]);
}
Impact: HomePublic.vue fetches this endpoint on load to show the landing page to guest users. A 500 response causes the guest homepage to render empty/blank. Also breaks the cooperative public registration flow that depends on the public API layer being healthy.
Route: GET /api/public/landing-page — no middleware, no auth required.
notes
- dictionary: ai-docs/dictionary.md
- linters: none
- constraints: Use
Response::json()facade (notresponse()->json()). Use Hypervel migration imports (Hyperf\Database\Schema\Blueprint,Hypervel\Database\Migrations\Migration,Hypervel\Support\Facades\Schema) if adding a new migration.