# GoDaddy / cPanel Deployment (balorpfinishes)

URL target: **http://balorpfinishes.com/**

This app expects:
- **Web root document root** should point to **`public/`** (best option).
- URL routing is handled by `public/index.php` + `app/core/Router.php`.
- Uploaded files live in `storage/` and must be writable.

---

## 1) Upload files
Upload the entire project folder to your account, for example:
- `balorpfinishes/`

---

## 2) Set Document Root (recommended)
In cPanel → **Domains / Document Root** (wording varies):
- Set the document root to:
  - `.../balorpfinishes/public/`

This makes:
- `http://balorpfinishes.com/` serve `public/index.php`
- `/css/...`, `/images/...`, and routed URLs work.

---

## 3) (If your host does NOT allow public/ as document root)
Fallback option:
- Move the **contents** of `public/` into the actual web root.
- Keep the `public/.htaccess` logic compatible with the moved structure.

---

## 4) Create the MySQL database
In cPanel → MySQL Databases:
- Create a database
- Create a user
- Assign user privileges

---

## 5) Import schema
Open phpMyAdmin → select your database → Import:
- `database/schema.sql`

---

## 6) Update database credentials
Edit:
- `config/config.php`

Set:
- `database.host` to `localhost`
- `database.name` to your database name
- `database.user` to your db user
- `database.pass` to your db password

Also ensure production settings:
- `app.debug` => `false`

---

## 7) Set writable permissions
Make sure PHP can write to these folders:
- `storage/uploads/`
- `storage/uploads/` (contains photos)
- `storage/documents/`
- `storage/photos/`
- `storage/logs/`

Common cPanel permission approach:
- Set owner to your hosting user
- Permission often: **755** for dirs, **664** for files (choose what your host allows)

---

## 8) Enable Apache Rewrite (.htaccess)
- Ensure Apache `mod_rewrite` is enabled.
- The routing requires rewriting requests to `public/index.php`.

---

## 9) Create the first Admin user
Create an admin user in `users` table.

If you don’t have the password hash yet:
- generate one using PHP `password_hash()` locally

Then insert a user like:
```sql
INSERT INTO users (role_id, name, email, password_hash, phone)
VALUES (1, 'Balorp Owner', 'admin@balorpfinishes.com', '$2y$10$REPLACE_WITH_YOUR_HASH', '+233240000000');
```

---

## 10) Test from browser
Test these pages:
- `http://balorpfinishes.com/`
- `http://balorpfinishes.com/services`
- `http://balorpfinishes.com/admin`
- `http://balorpfinishes.com/portal/login`

Check assets load:
- `http://balorpfinishes.com/css/style.css`
- `http://balorpfinishes.com/images/balorplogo1.png`

---

## Troubleshooting
### 404 on routes (e.g. /admin)
- Verify document root is `public/`
- Verify `.htaccess` is being read
- Verify `mod_rewrite` is enabled

### Assets not loading (css/images)
- Verify base paths are correct (document root at `public/` is required)

### 500 errors
- Check `storage/logs/` files
- Confirm correct DB credentials in `config/config.php`

