====================================================================
  MULTI LANDING PAGE CMS — DEPLOYMENT GUIDE
====================================================================

REQUIREMENTS
------------
  - PHP 8.2+ with extensions: sodium, pdo_mysql, mbstring, openssl,
    tokenizer, xml, ctype, json, bcmath, fileinfo, zip
  - MySQL 8.0+
  - Composer 2.x
  - Web server: Apache (with mod_rewrite) or Nginx

STEP 1 — COPY FILES TO SERVER
------------------------------
  Upload the contents of the /cms folder to your web server.
  Point your domain's document root to: /cms/public

  Example Nginx config:
    root /var/www/yoursite/cms/public;
    index index.php;
    location / { try_files $uri $uri/ /index.php?$query_string; }
    location ~ \.php$ { fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; }

STEP 2 — INSTALL PHP DEPENDENCIES
------------------------------------
  In the /cms folder, run:
    composer install --no-dev --optimize-autoloader

STEP 3 — SET DIRECTORY PERMISSIONS
-------------------------------------
  chmod -R 775 storage bootstrap/cache
  chown -R www-data:www-data storage bootstrap/cache

STEP 4 — RUN THE INSTALLER
----------------------------
  Visit: https://yourdomain.com/install

  The installer will:
    a) Check server requirements
    b) Test your database connection
    c) Write the .env file
    d) Run all migrations
    e) Seed all 15 landing pages + 150 blog articles
    f) Create your admin account
    g) Lock the installer permanently

STEP 5 — SET UP THE LICENSE GENERATOR (one-time, on your local PC)
-------------------------------------------------------------------
  On the machine where you store your private key:
    cd license-generator
    php generate.php keygen

  This creates keys/private.key and keys/public.key.
  BACK UP private.key SECURELY — it cannot be recovered.

  Copy the public key hex into the CMS:
    In your server's .env file, add:
      LICENSE_PUBLIC_KEY=<paste hex here>

    Then on the server run:
      php artisan config:clear

STEP 6 — ISSUE YOUR FIRST LICENSE
------------------------------------
  On your local machine (in license-generator/):
    php generate.php issue \
      --customer-name="Your Company" \
      --customer-email="you@yourdomain.com" \
      --domain="yourdomain.com" \
      --expires="2027-12-31"

  This creates a .lic file in license-generator/issued/

STEP 7 — ACTIVATE THE LICENSE
-------------------------------
  Log into your CMS admin: https://yourdomain.com/admin
  Go to: System > License
  Upload the .lic file and click Activate.

STEP 8 — DONE
--------------
  Your CMS is live. The homepage shows the first active landing page.
  All 15 landing pages are published and accessible.
  Manage everything from: https://yourdomain.com/admin

====================================================================
  QUICK REFERENCE
====================================================================

  Admin URL:       https://yourdomain.com/admin
  Installer URL:   https://yourdomain.com/install  (locked after use)
  Frontend URL:    https://yourdomain.com
  Blog URL:        https://yourdomain.com/{page-slug}/blog

  Admin credentials: set during install step
  Default homepage:  Luxury Travel (change in Admin > Landing Pages)

====================================================================
  TROUBLESHOOTING
====================================================================

  500 error on install?
    -> Check storage/ and bootstrap/cache/ are writable (Step 3)

  "Class not found" errors?
    -> Run: composer install --no-dev --optimize-autoloader

  License page shows "public key not configured"?
    -> Complete Step 5 (keygen) and Step 7 (set env var)

  Admin login redirects back to login?
    -> Check SESSION_DRIVER in .env (use 'file' if Redis unavailable)
    -> Ensure storage/framework/sessions is writable

  Installer already completed but need to re-run?
    -> In MySQL: UPDATE installation_metadata SET value='false'
       WHERE key='installer_completed';
    -> Or delete the installation_metadata table row.

====================================================================
