# cPanel deployment guide

## Recommended directory layout

Create a subdomain and point its document root to the Laravel `public` directory.

Example application directory:

```text
/home/CPANEL_USER/reviewguard
```

Example subdomain document root:

```text
/home/CPANEL_USER/reviewguard/public
```

Do not expose the project root as the public document root.

## Deployment steps

1. In cPanel, select PHP 8.2 or newer for the subdomain.
2. Create a MySQL database and database user. Grant the user all permissions on that database.
3. Upload the ZIP file to your home directory and extract it as `reviewguard`.
4. Point the subdomain document root to `/home/CPANEL_USER/reviewguard/public`.
5. Open cPanel Terminal and enter the application directory.
6. Copy `.env.example` to `.env`.
7. Update `APP_URL`, the MySQL values, and the administrator email and password in `.env`. You may also set `OUTSCRAPER_API_KEY`, or configure that key later inside the application.
8. The package includes production dependencies. Run the commands below. If Composer is unavailable, skip the first command and use the included `vendor` directory.

```bash
composer install --no-dev --optimize-autoloader
php artisan key:generate
php artisan migrate --force
php artisan db:seed --force
php artisan storage:link
php artisan optimize
```

9. Make sure `storage` and `bootstrap/cache` are writable by the cPanel account.

```bash
chmod -R 775 storage bootstrap/cache
```

10. Open the application URL and sign in with the administrator details from `.env`.

## Google OAuth setup

In Google Cloud Console, create OAuth web credentials and add this callback URL:

```text
https://YOUR_DOMAIN/settings/google/callback
```

Put the client ID, client secret, and exact callback URL in `.env`. Run `php artisan config:clear`, connect Google inside the application, then run `php artisan optimize` again.

Google may require Business Profile API approval. Until approval is available, use manual review entry or CSV import.

Google OAuth is optional. For public link scanning without a client email or profile connection, create an Outscraper API key and configure it on the Public scanner screen. The application encrypts the key. Each business then needs only its public Google Maps URL.

Public scanning is a data collection feature. Reporting and removal decisions remain with Google, and no success percentage is guaranteed. Record every submitted, rejected, appealed, removed, or closed result in the case tracker so the actual dashboard rate remains accurate.

## Cron

This version does not require a queue worker or cron job. Review sync is started manually from the business screen.

## Updating administrator access

Change `ADMIN_EMAIL` and `ADMIN_PASSWORD` in `.env`, then run:

```bash
php artisan db:seed --force
```

Use a unique password. Do not leave the example password in production.

## Troubleshooting

If the site returns a server error, check `storage/logs/laravel.log`.

If CSS is missing, confirm the subdomain document root ends in `/public`.

If database tables are missing, run `php artisan migrate --force`.

If Google returns a redirect error, make sure the callback URL in Google Cloud and `.env` match exactly and use HTTPS.
