========================================================
 GOD'S TREAT — cPanel DEPLOYMENT GUIDE (READ FULLY FIRST)
========================================================

Yeh zip already composer-installed hai (vendor/ folder included hai),
isliye SSH/composer ki zaroorat nahi. Sirf upload + extract + install.php
form bharo — site live ho jayegi.

--------------------------------------------------------
WHAT'S INSIDE THIS ZIP
--------------------------------------------------------
laravel_app/              -> poora Laravel application (code + vendor)
laravel_app/public/       -> web-facing folder (images, css, install.php)
public_html_index.php     -> sirf METHOD 2 ke liye (neeche dekho)
METHOD3_root_htaccess.txt -> sirf METHOD 3 ke liye (neeche dekho)
DEPLOY_INSTRUCTIONS.txt   -> yeh file

--------------------------------------------------------
STEP 1 — CREATE MYSQL DATABASE (cPanel)
--------------------------------------------------------
1. cPanel login karo -> "MySQL Databases" kholo.
2. Naya database banao, e.g. "godstreat" (final naam hoga
   cpaneluser_godstreat).
3. Naya database user banao, e.g. "godstreat" (final naam hoga
   cpaneluser_godstreat) + strong password set karo, ise likh lo.
4. "Add User to Database" me us user ko database se jodo, aur
   "ALL PRIVILEGES" tick karo.
   (SQLite bhi chalega chhote traffic ke liye — installer me option hai,
   par MySQL zyada reliable hai shared hosting par.)

--------------------------------------------------------
STEP 2 — CHOOSE PHP VERSION
--------------------------------------------------------
cPanel -> "MultiPHP Manager" -> apni domain select karo -> PHP 8.2 ya
8.3 choose karo (jo bhi available ho, minimum 8.2 chahiye).

--------------------------------------------------------
STEP 3 — UPLOAD & PLACE FILES (3 methods, koi ek choose karo)
--------------------------------------------------------

★ METHOD 1 — RECOMMENDED (agar hosting document root change karne deta hai)
--------------------------------------------------------------------------
1. cPanel File Manager kholo, home directory me jao (public_html ke
   BAHAR, ek level upar).
2. Is zip ko upload karke extract karo. Aapko "laravel_app" folder
   milega home directory me, e.g. /home/cpaneluser/laravel_app
3. cPanel -> "Domains" (ya "Addon Domains") kholo -> apni domain edit
   karo -> "Document Root" ko badal kar likho:
       laravel_app/public
4. Save karo. Bas — yahi sabse secure aur clean tarika hai, kyunki
   aapka app code seedha internet se accessible nahi hota.
5. Browser me jao: https://yourdomain.com/install.php

★ METHOD 2 — FALLBACK (agar document root change nahi hota)
--------------------------------------------------------------------------
1. Zip ko home directory me extract karo (public_html ke bahar), same
   as Method 1 step 1-2. Aapko "laravel_app" folder milega.
2. Ab "laravel_app/public/" folder ke ANDAR ki SAARI files/folders
   (install.php, index.php, .htaccess, images/, css/, favicon.ico,
   robots.txt) copy karke "public_html" ke ANDAR paste karo.
3. "public_html_index.php" file ko "public_html" me copy karo aur
   rename karke "index.php" banao — yeh purani index.php ko REPLACE
   karegi (kyunki isme laravel_app ka sahi path already set hai).
4. Browser me jao: https://yourdomain.com/install.php

★ METHOD 3 — LAST RESORT (agar sirf public_html hi mila hai, koi
   subfolder allowed nahi)
--------------------------------------------------------------------------
1. "laravel_app" folder ke ANDAR ki SAARI files/folders (app, bootstrap,
   config, database, public, resources, routes, storage, vendor,
   artisan, composer.json, .env.example) seedha "public_html" ke ANDAR
   paste karo (public_html khud laravel_app ban jayega).
2. "METHOD3_root_htaccess.txt" ko public_html ke ROOT me copy karke
   rename karo ".htaccess" (is naam se — dot ke saath, extension nahi).
   NOTE: agar public_html me pehle se .htaccess hai to usmein yeh rules
   ADD karo, replace mat karo.
3. Browser me jao: https://yourdomain.com/install.php
   (Yeh /public/install.php ko automatically serve karega.)

--------------------------------------------------------
STEP 4 — FOLDER PERMISSIONS
--------------------------------------------------------
File Manager me "laravel_app/storage" aur "laravel_app/bootstrap/cache"
folders (sab subfolders sahit) ko permission 755 do. Agar installer
"NOT WRITABLE" bole to 775 try karo.

--------------------------------------------------------
STEP 5 — RUN THE INSTALLER
--------------------------------------------------------
1. https://yourdomain.com/install.php kholo.
2. "Server Requirements" section check karo — sab green tick hona
   chahiye. Agar koi red cross hai, host se woh PHP extension enable
   karne ko bolo ya permission fix karo, phir page reload karo.
3. Form bharo:
   - Store Name, Site URL (https://yourdomain.com, trailing slash NAHI)
   - Database: MySQL choose karo, Step 1 wale host/name/user/password
     bharo (host aksar "localhost" hota hai)
   - Admin Account: apna naam, email, aur strong password (yeh aapka
     admin login banega)
   - Razorpay keys aur SMTP details baad me bhi daal sakte ho, abhi
     khali chhod sakte ho
4. "Install Now" click karo. Yeh automatically:
   - .env file banayega
   - Database migrate + seed karega (8 products, coupons: WELCOME10,
     FLAT50, GT20)
   - Aapka admin account create karega
   - storage/public link setup karega
   - Cache clear karega
5. Success message dikhega with login link.

--------------------------------------------------------
STEP 6 — IMPORTANT: DELETE install.php
--------------------------------------------------------
Install successful hone ke baad, File Manager se "install.php" file
DELETE kar do (jahan bhi copy ki thi — public_html ya laravel_app/public
me). Isko live chhodna security risk hai kyunki koi bhi ise dobara run
karne ki koshish kar sakta hai.
(Installer khud ek "storage/installed.lock" file banata hai jo dobara
run hone se rokta hai, par file delete karna best practice hai.)

--------------------------------------------------------
STEP 7 — ENABLE SSL (HTTPS)
--------------------------------------------------------
cPanel -> "SSL/TLS Status" ya "Let's Encrypt SSL" -> apni domain select
karke "Run AutoSSL" karo. Free SSL kuch minutes me active ho jayega.
Uske baad .env me APP_URL ko https:// se update karna na bhoolo (agar
already https diya tha install ke time, kuch karne ki zaroorat nahi).

--------------------------------------------------------
POST-INSTALL — CHIZEIN JO BAAD ME KARNI HAIN
--------------------------------------------------------
- Razorpay LIVE keys: laravel_app/.env me RAZORPAY_KEY / RAZORPAY_SECRET
  update karo (Razorpay dashboard se live keys lekar), phir File
  Manager/SSH se cache clear karo, ya installer form me hi daal do.
- Email (order confirmations): .env me MAIL_HOST/MAIL_USERNAME/
  MAIL_PASSWORD update karo (Gmail app-password ya cPanel email account).
- Product photos: admin panel -> Products -> edit -> gallery images
  upload karo.
- Shipping zones: admin panel -> Shipping -> apne delivery pincodes ke
  hisab se zones banao.

--------------------------------------------------------
TROUBLESHOOTING
--------------------------------------------------------
500 Internal Server Error:
  - PHP version 8.2+ hai confirm karo (MultiPHP Manager).
  - storage/ aur bootstrap/cache/ permission 755/775 hai confirm karo.
  - cPanel -> "Errors" log ya laravel_app/storage/logs/laravel.log
    kholo, actual error dekho.

"install.php" 403 "Already Installed":
  - Matlab pehle se install ho chuka hai. laravel_app/storage/
    installed.lock delete karo agar jaan-boojh kar dobara run karna hai
    (data delete nahi hoga, migrations/seeders safe hain re-run ke liye).

Images/product photos nahi dikh rahi:
  - laravel_app/public/storage folder check karo — installer ne ise
    laravel_app/storage/app/public se link/copy kiya hoga. Agar missing
    hai, installer ko dobara chalao ya manually symlink karo:
    "storage/app/public" -> "public/storage"

Database connection error install ke waqt:
  - cPanel MySQL Databases me database/user/privileges dobara check
    karo. Host generally "localhost" hota hai (127.0.0.1 nahi).

========================================================
 Questions? Refer to Laravel deployment docs:
 https://laravel.com/docs/deployment
========================================================
