---
task: Fix GET /api/public/landing-page returning HTTP 500 — wrong response helper + pending migration
cycles: 3
context: true
private: false
started: 2026-05-16T15:59:26Z
finished: 2026-05-16T16:00:00Z
---

## files
- app/Http/Controllers/Admin/LandingPageController.php [lines 241-262] — uses `response()->json()` instead of `Response::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_pages` table is absent the query throws and returns 500
- routes/web.php [line 689] — `Route::get('/api/public/landing-page', ...)` — no middleware, correctly public

## steps
1. In `LandingPageController::getActiveLandingPage()` replace both `response()->json([...])` calls with `Response::json([...])` using the Hypervel facade (`use Hypervel\Support\Facades\Response;` is already imported at the top of the file — add it if missing).
2. Add a `try/catch` around `LandingPage::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.
3. Confirm (or trigger via Ultimate Console → Migrate button, or `php artisan migrate --force` in the container) that the `landing_pages` migration has been applied on production.

## context
```php
// 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 (not `response()->json()`). Use Hypervel migration imports (`Hyperf\Database\Schema\Blueprint`, `Hypervel\Database\Migrations\Migration`, `Hypervel\Support\Facades\Schema`) if adding a new migration.
