TamdidYar — cPanel Deployment Package
======================================

This ZIP contains two folders, matching the split layout cPanel needs so
the Laravel application code stays OUTSIDE your public web root:

  tamdidyar-app/   -> upload to a directory ABOVE public_html, e.g.
                       /home/your_username/tamdidyar-app/
                       (already includes vendor/ — composer install is
                       NOT required unless you change a dependency)

  public_html/     -> upload the CONTENTS of this folder into your
                       domain's public_html/ (or subdomain doc root)
                       This is the compiled React SPA + Laravel's
                       index.php/.htaccess merged into one folder.
                       Its index.php already points at ../tamdidyar-app/
                       — do not edit it unless your folder names differ.

IMPORTANT: on the server, tamdidyar-app/ and public_html/ must be
SIBLINGS (both directly under /home/your_username/), never one nested
inside the other. If you extract this zip directly inside public_html,
move tamdidyar-app/ back out one level before continuing.

Quick steps
-----------
1. Upload both folders as described above via FTP/File Manager (fastest:
   upload the zip itself to your home directory, then use File Manager's
   "Extract" — much faster than FTP-ing 16,000+ vendor files one by one).

2. In tamdidyar-app/, copy .env.example to .env and fill in real values:
   DB_DATABASE, DB_USERNAME, DB_PASSWORD (cPanel -> MySQL Databases),
   APP_URL / FRONTEND_URL (your real domain), MAIL_* (your cPanel email
   account). You need an APP_KEY and VAPID_PUBLIC_KEY/VAPID_PRIVATE_KEY —
   see "No Terminal/SSH access?" below for ready-to-paste values if you
   can't run artisan commands yourself. Do NOT reuse any key you've seen
   elsewhere in this project's history for a real deployment — generate
   your own.

3. Set up the database tables. Two options:

   With Terminal/SSH, from tamdidyar-app/:
     php artisan key:generate
     php artisan migrate --force
     php artisan db:seed --class=Database\\Seeders\\CategorySeeder --force
     php artisan webpush:vapid

   No Terminal/SSH access? Skip artisan entirely:
     a. Ask for (or generate) a fresh APP_KEY and VAPID key pair and paste
        them directly into .env as three lines:
          APP_KEY=base64:...
          VAPID_PUBLIC_KEY=...
          VAPID_PRIVATE_KEY=...
        These are just random values — any correctly-generated set works,
        they don't need to come from your own server.
     b. Import the database schema via phpMyAdmin: cPanel -> phpMyAdmin ->
        select your database -> Import tab -> choose the schema .sql file
        -> Go. This creates every table (including the `migrations` table
        with the right rows already recorded) and seeds the default
        categories — no cron and no command execution required.
     Do NOT also set up the one-time cron mentioned in older instructions
     for this — the schema import replaces it entirely and is more
     reliable (a cron that silently never fires is what left earlier
     installs with an empty database).

4. Add a permanent cPanel cron job (Once Per Minute) — this is what sends
   the actual push/email renewal reminders on schedule. The app itself
   works without it (item status like "expiring soon"/"expired"/"overdue"
   is now computed live every time you load the list, not dependent on
   this cron), but reminders won't go out until it's running:
     * * * * * cd /home/your_username/tamdidyar-app && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1

5. Set folder permissions so the web server can write to
   tamdidyar-app/storage and tamdidyar-app/bootstrap/cache (typically
   755/775 depending on your host) — usually only needed if you hit a
   500 error mentioning storage/cache.

Upgrading an existing install
------------------------------
If you're deploying this over a site that's already live and has real
data, don't re-import the whole schema (it would try to recreate tables
that already exist). Instead, just run this one ALTER TABLE via
phpMyAdmin's SQL tab against your existing database — it only adds a new
column, nothing is deleted or overwritten:

  ALTER TABLE `user_settings`
    ADD COLUMN `disabled_options` JSON NULL AFTER `reminder_offsets`;

  INSERT INTO `migrations` (`migration`, `batch`)
  VALUES ('2026_01_01_000009_add_disabled_options_to_user_settings_table',
          (SELECT MAX(batch) FROM (SELECT batch FROM migrations) AS m));

Then just replace the tamdidyar-app/ and public_html/ folders with the
new ones from this ZIP (your .env is untouched since it isn't part of
this package) — no other database changes are needed for this update.

What's new in this build
-------------------------
- Fixed the real reason reminders were never sent: the push library
  crashed the whole reminder job on any PHP build missing the GMP/BCMath
  extensions (common on shared hosting), so every pending reminder sat
  stuck forever no matter how the cron was configured. Also added a
  "Run Reminder Check Now" button on the Diagnostics page so you can
  trigger and inspect the real dispatch job on demand, with no
  SSH/terminal and without waiting on cron.
- Fixed the PWA install button doing nothing: the manifest only listed
  an SVG icon, which fails Chrome/Edge's install eligibility check on
  many versions. Added real 192x192/512x512 PNG icons.

Full details, every required environment variable, and troubleshooting
are in this project's README.md (section "cPanel Shared Hosting
Deployment Guide").
