# OUTSYDE setup and admin guide

## Install on XAMPP (Windows / macOS / Linux)
1. Copy the project to `htdocs/outsyde` (or point a virtual host at the `public/` folder).
2. Start Apache and MySQL in XAMPP. In phpMyAdmin create a database named `outsyde` (utf8mb4).
3. Copy `.env.example` to `.env` and set `APP_URL` (e.g. `http://localhost/outsyde/public`) and the DB values.
4. Enable the PHP extensions `pdo_mysql`, `mbstring`, `openssl`, `fileinfo`, `curl` and `gd` (XAMPP's php.ini: remove the `;` in front of each).
5. From a terminal in the project folder: `php database/migrate.php`
   This applies the base schema and every migration (001 to 004). It is safe to run again; applied migrations are skipped and nothing is dropped.
6. Make sure `storage/` and `public/uploads/` are writable.
7. Register an account, then make it admin (see below).

## Upgrading an existing install
Back up the database, copy the new files over the old ones, run `php database/migrate.php`. Migration 004 adds the settings, hero, homepage, audit, rate-limit, share, impression and comment-report tables, plus the new post/comment columns. Existing posts keep their titles; new posts do not need one. Users who already chose interests are marked as onboarded.

## First admin
Insert the admin role for your user in phpMyAdmin (`user_roles`), or use an existing admin and grant it from **Admin > Users**. Admin pages live under `/admin`.

## Admin map
| Area | Where | What it does |
|---|---|---|
| Dashboard | Admin | Live counts, setup checklist, recent users and admin activity |
| Settings > General | Admin > Settings | Site name, tagline, description, public URL, timezone, locale, currency, footer and copyright text |
| Settings > Logo & branding | same | Logo, light-background logo, favicon, default avatar, social image, hero fallback: choose a file, preview, save, or reset to default. Uploaded files are re-encoded and cache-busted |
| Settings > Contact & social | same | Emails, phone, address and social links (only filled links show in the footer) |
| Settings > SEO | same | Home title and description, social site name, Google Analytics ID |
| Settings > Platform | same | Maintenance mode (admins still get in), open registration, require email verification, feature toggles for posting, comments, reposts, community creation, blog, hero autoplay |
| Settings > Security & limits | same | Login lockout, post/comment rate limits, length limits, images per post, upload size, edit window |
| Settings > Appearance | same | Dark/light theme, colour pickers, corner style, button shape, live preview. Blank colours follow the theme |
| Integrations | Admin > Integrations | SMTP, Paystack, Flutterwave, Google Maps. Secrets are encrypted and never shown again; blank keeps the saved value. Test buttons make real requests |
| Hero slider | Admin > Hero slider | Slides with desktop and mobile images, two buttons, overlay, alignment, schedule, enable/disable, order; autoplay and interval; fallback image |
| Homepage | Admin > Homepage | Show, hide, reorder and edit each section below the hero |
| Users / Organizers | Admin | Roles, restrict or lift (restricted accounts cannot post, comment or like) |
| Events / Orders | Admin | Status, featured flag, tickets sold vs capacity; orders with filters |
| Communities / Posts / Comments / Reports | Admin | Hide, restore, feature; reports resolve, dismiss or remove content in one step |
| Media | Admin > Media | Every uploaded image, flagged "in use"; unused files can be deleted |
| Insights / Audit log | Admin | Real 14-day feed metrics; who changed what (secret values are never logged) |

## Notes
- Checkout uses Paystack. Flutterwave credentials can be saved and tested but are not used in checkout.
- Trending topics come from real hashtags in the last 7 days. Impressions count a viewer once per post per day; authors' own views are excluded.
- If settings or hero pages say a table is missing, run `php database/migrate.php`.

## Uploads (images and video)
Posts accept JPG, PNG, WebP, GIF and MP4/WebM/MOV with no app-level size cap (Admin > Settings > Security & limits: "Upload size limit", 0 = none). `public/.htaccess` raises PHP's limits to 2 GB for Apache module PHP (XAMPP). If uploads still fail with "bigger than this server allows", set `upload_max_filesize` and `post_max_size` in `C:\xampp\php\php.ini` and restart Apache. Videos are stored as uploaded (no transcoding), so large files use disk space and bandwidth.
Post and comment rate limits default to 0 (off); set a number in the same settings screen to enable them.

## Making money: fees, commission and payouts

1. Run `php database\migrate.php` once (adds migration 005).
2. Admin → Settings → **Fees & commission**: set the commission percentage and/or a fixed fee per ticket, and choose who pays.
   - *Buyer pays*: the fee is added on top of the ticket price at checkout; the organizer receives the full ticket price.
   - *Organizer pays*: the buyer pays the ticket price; the fee is deducted from the organizer's earnings.
3. Admin → **Earnings & payouts** shows your commission, estimated gateway costs and profit, and what each organizer is owed. Click **Rate** to give one organizer a custom percentage.
4. Organizers add their bank details under Organizer → **Earnings & payouts**. Pay them by bank transfer, then click **Pay out** to record it so balances stay correct.

Payouts are recorded manually; the app does not send money automatically. Free tickets never carry a fee. Gateway costs shown are estimates.
