# FanLeague Arena — Fix Notes

## What was fixed

### 1. Fatal database errors
The uploaded error log showed the app failing because the production database was missing required tables:

- `users`
- `plans`
- `trend_snapshots`
- `community_room_members`

The fixed package now includes:

- `public/install/index.php` — public-document-root installer for cPanel setups where the domain points to `/public`.
- `public/upgrade/repair.php` — full repair runner for missing or partially installed databases.
- `upgrade/repair.php` — root repair runner.
- Safer database helpers in `app/Core/Database.php`.
- Safer home, pricing, trends, community, and news handling when a table is missing.

### 2. Styling and layout modernization
The CSS was rebuilt into a more professional sports fan / fantasy league platform look:

- Stadium-style dark background.
- Stronger cards, scoreboards, league badges, tabs, and buttons.
- Better mobile responsiveness.
- Fixed undefined CSS variable issue by adding `--border`.
- Improved plan cards, news cards, live score cards, trend cards, and community rooms.

### 3. News warning fix
The warning from `resources/views/news/index.php` was fixed by safely reading:

- `source_name`
- `source_provider`
- `source_label`

This prevents PHP warnings when older news records or older table structures are present.

## How to repair the live site

1. Upload this fixed package over the existing site.
2. Visit:

```text
https://yourdomain.com/upgrade/repair.php
```

If your document root is the project root instead of `/public`, use:

```text
https://yourdomain.com/public/upgrade/repair.php
```

3. Type `REPAIR` and run the repair.
4. Confirm all required tables show `Ready`.
5. Delete or password-protect:

```text
/public/install/
/public/upgrade/
/upgrade/
```

6. Log in with the seeded admin if needed:

```text
admin@example.com
ChangeMe123!
```

Change the password immediately before launch.

## Launch notes

- Keep `APP_DEBUG=false` in `.env`.
- Make sure the domain document root points to `/public`.
- Remove public installer and upgrade access after the database is repaired.
- Connect real payment validation before going live with paid plan activation.

## v1.4.1 SQL Seed Hotfix

Fixed the installer/repair SQL error:

`SQLSTATE[21S01]: Insert value list does not match column list: 1136 Column count doesn't match value count at row 5`

Cause: the `v1_3_upgrade_installed_at` setting row had 3 values for 4 columns in `database/schema.sql` and the v1.3 migration.

Fix applied:
- `database/schema.sql`
- `database/migrations/2026_05_19_v1_3_full_feeds_news_ai_community.sql`

All SQL `INSERT ... VALUES` blocks have been rechecked for matching column/value counts.
