# Deploy lerosgroup.com to Bluehost (cPanel)

This package is ready to upload: production PHP packages are installed in `vendor/`, the CSS/JS is built in
`public/build/`, uploaded images are in `storage/app/public/`, and the site content is in
`database/deploy/leros-content.sql`. No Node.js is needed on the server.

## 1. Before you start

- cPanel → **MultiPHP Manager** → set the domain to **PHP 8.3**.
- cPanel → **MultiPHP INI Editor** (or `public/.user.ini`, already included): upload_max_filesize 12M,
  post_max_size 16M, memory_limit 512M, max_execution_time 120.
- PHP extensions needed: pdo_mysql, mbstring, openssl, gd, intl, zip, fileinfo, bcmath.
- Take a full cPanel backup of the old site first. Remove the old (hacked) site files; do not reuse any of its PHP.

## 2. Upload the files

Upload the **contents of this folder** to `/home/<cpanel-user>/lerosgroup/` (outside `public_html`), with cPanel
File Manager (upload the zip and choose Extract) or SFTP.

```
/home/<cpanel-user>/
├── lerosgroup/        ← this package (app, vendor, storage, .env …)
│   └── public/        ← the website's document root
└── public_html/
```

## 3. Point the domain at `public/`

**Option A (recommended):** cPanel → **Domains** → lerosgroup.com → Manage → set the **Document Root** to
`lerosgroup/public`.

**Option B (if the document root cannot be changed):** copy everything inside `lerosgroup/public/` (including
`.htaccess` and `.user.ini`) into `public_html/`, then in `public_html/index.php` change the two paths:

```php
require __DIR__.'/../lerosgroup/vendor/autoload.php';
$app = require_once __DIR__.'/../lerosgroup/bootstrap/app.php';
```
(and the maintenance line to `__DIR__.'/../lerosgroup/storage/framework/maintenance.php'`).
With option B, re-copy `public/build/` into `public_html/build/` after every future front-end change.

## 4. Database

1. cPanel → **MySQL Databases** → create a database and a user, add the user to the database with
   **All Privileges**.
2. Rename `.env.production` to `.env` and fill in:
   the `MAIL_*` lines (cPanel → Email Accounts → Connect Devices). The database name, user and password are
   already filled in.
   **Do not change `APP_KEY`**: the admin's two-factor (MFA) secret is encrypted with it.

## 5. Import the database (no terminal needed)

cPanel → **phpMyAdmin** → click the database `onyxmblm_lerosgrp_leros` on the left → **Import** →
choose `database/deploy/leros-full-database.sql` → **Go**.
This one file creates all 31 tables and fills in the content. It drops any table with the same name first,
so it is safe to run again on the same database.

## 6. Finish the install (cPanel → Terminal, or SSH)

```bash
cd ~/lerosgroup
php artisan storage:link             # makes /storage/... images public
php artisan optimize                 # caches config, routes, views
chmod -R 775 storage bootstrap/cache
```

If `storage:link` is not allowed on the host, create the link in File Manager or run:
`ln -s ~/lerosgroup/storage/app/public ~/lerosgroup/public/storage` (option B: `~/public_html/storage`).

## 7. Cron job (scheduler)

cPanel → **Cron Jobs** → Once Per Minute:

```
cd /home/<cpanel-user>/lerosgroup && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1
```

This publishes scheduled blog posts, sends lead emails (queue), and rebuilds the sitemap daily.

## 8. SSL and go-live checks

- cPanel → **SSL/TLS Status** → run AutoSSL for lerosgroup.com and www.lerosgroup.com.
- Open https://lerosgroup.com: home, about, services, contact and a blog post load; images show.
- Admin: `https://lerosgroup.com/lg-console-8g3bqy` — same email, password and authenticator app as on the
  local computer.
- Send a test from the consultation form; the lead appears in Admin → Leads and the email arrives.
- Site settings → add the real social links, the WhatsApp number and business hours if needed.
- Google Search Console: submit `https://lerosgroup.com/sitemap.xml`.

## Updating the site later

Change locally → `npm run build` → upload the changed files (and `public/build/`) → on the server run
`php artisan migrate --force` and `php artisan optimize`.
