# Prime Next Courier Express Ltd. — Laravel 11.55.1 Installation

This is an **overlay package** for an existing Softaculous Laravel **11.55.1** application running on **PHP 8.3.33**.

Target application:

`https://design.webbonafide.com/pncs/public/`

The overlay intentionally does **not** replace the Laravel core, `.env`, `vendor/`, `artisan`, `public/index.php`, or `bootstrap/app.php`.

## 1. Back up first

In cPanel:

- Back up the `pncs` application directory.
- Export the MySQL database from phpMyAdmin.
- Keep the backup until the site passes the smoke test.

Do not upload this overlay as a replacement for the whole Laravel project.

## 2. Upload the overlay

Upload the contents of this ZIP into the existing Laravel project directory, for example:

`/home/USERNAME/public_html/pncs/`

Choose **Extract** and allow the overlay's `app/`, `config/`, `database/`, `resources/`, `routes/`, and `public/assets/` files to merge with the existing project.

Do not delete the existing Laravel core files.

## 3. Install the two Laravel packages

From SSH/Terminal, or cPanel Terminal:

```bash
cd /home/USERNAME/public_html/pncs
php -v
php artisan --version
composer require laravel/socialite:^5.23 barryvdh/laravel-dompdf:^3.1
```

Expected Laravel version:

```text
Laravel Framework 11.55.1
```

If your hosting Composer command is `php /path/to/composer.phar`, use that form instead.

## 4. Configure `.env`

Keep your existing `.env` values and verify/update these values:

```dotenv
APP_NAME="Prime Next Courier Express Ltd."
APP_ENV=production
APP_DEBUG=false
APP_URL=https://design.webbonafide.com/pncs/public

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=YOUR_DATABASE
DB_USERNAME=YOUR_DATABASE_USER
DB_PASSWORD=YOUR_DATABASE_PASSWORD

MAIL_MAILER=smtp
MAIL_HOST=YOUR_SMTP_HOST
MAIL_PORT=587
MAIL_USERNAME=YOUR_SMTP_USERNAME
MAIL_PASSWORD=YOUR_SMTP_PASSWORD
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="no-reply@YOUR-DOMAIN"
MAIL_FROM_NAME="Prime Next Courier Express Ltd."

QUEUE_CONNECTION=sync

ADMIN_NOTIFICATION_EMAIL="YOUR_ADMIN_EMAIL"
GA4_MEASUREMENT_ID=

GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_REDIRECT_URI="https://design.webbonafide.com/pncs/public/auth/google/callback"
```

`QUEUE_CONNECTION=sync` is recommended initially on shared/Softaculous hosting so the six email notification types do not require a continuously running queue worker. You can move to a database/Redis queue later with cron/supervisor configuration.

## 5. Add Google OAuth configuration

Open the existing `config/services.php` and add:

```php
'google' => [
    'client_id' => env('GOOGLE_CLIENT_ID'),
    'client_secret' => env('GOOGLE_CLIENT_SECRET'),
    'redirect' => env('GOOGLE_REDIRECT_URI'),
],
```

In Google Cloud Console, the authorized redirect URI must exactly match:

`https://design.webbonafide.com/pncs/public/auth/google/callback`

Do not commit Google secrets to Git or expose them in Blade templates.

## 6. Run migrations

The Prime Next package deliberately **does not create a second `users` table**. Laravel 11's existing users table is extended by the included migration.

Run:

```bash
php artisan migrate --force
```

This creates:

- shipment/order records
- tracking milestone history
- quotes
- shipment documents
- blogs
- service pages
- FAQs
- contact enquiries
- invoices
- activity logs
- Prime Next fields on the existing `users` table

## 7. Seed Prime Next data

Do not replace your existing `DatabaseSeeder` just for this application. Run the dedicated seeder:

```bash
php artisan db:seed --class=PrimeNextSeeder --force
```

It creates the initial courier service pages, FAQs, blog content and two operational accounts if they do not already exist.

Initial accounts:

```text
Super Admin
admin@primenextcourier.com
ChangeMe!123

Staff
staff@primenextcourier.com
ChangeMe!123
```

**Immediately change both passwords after the first login.**

## 8. Storage link

Run:

```bash
php artisan storage:link
```

If the symlink is already present, Laravel may report that it exists; that is normally fine.

Customer shipment documents are stored under Laravel's public storage disk.

## 9. Clear Laravel caches

After copying files and changing `.env`:

```bash
php artisan optimize:clear
php artisan config:cache
php artisan route:cache
php artisan view:cache
```

If your hosting environment has unusual permissions and cache commands fail, run `php artisan optimize:clear` first and fix the reported directory permissions before re-caching.

## 10. Front-end assets

This Laravel-11 overlay is prepared for Softaculous/shared hosting without requiring Node.js for the first deployment.

The compiled-style stylesheet is copied to:

`public/assets/css/prime-next.css`

The main Blade layout loads that file directly, so `npm install` / `npm run build` is **not required** for the supplied first deployment.

If you later want to manage the CSS/JS through Vite, you can restore the normal Laravel Vite workflow separately.

## 11. Web root / `/public`

Your current URL contains `/public/`:

`https://design.webbonafide.com/pncs/public/`

That is usable for the current deployment.

For a cleaner production URL such as:

`https://design.webbonafide.com/pncs/`

configure the domain/subdomain/document root in cPanel to point to:

`/home/USERNAME/public_html/pncs/public`

Do this only after confirming the application works at the current URL.

## 12. Smoke test

After deployment, test these URLs:

```text
/
/about
/why-choose-us
/industries-served
/our-network
/careers
/faqs
/contact
/blog
/track
/services/d2c-courier-services
/services/door-to-door-courier-services
/services/global-courier-services
/services/last-mile-delivery
/services/international-courier-services
/auth/login
/auth/register
/customer
/admin
```

Also test:

1. Customer registration.
2. Customer login.
3. Customer shipment creation.
4. Tracking ID generation.
5. Public tracking lookup.
6. Customer document upload.
7. Admin login.
8. Admin shipment creation.
9. Manual tracking milestone update.
10. Delivery status update.
11. Invoice PDF download.
12. Quote request.
13. Contact enquiry.
14. Language switching.
15. Email delivery.
16. Google login after OAuth credentials are configured.

## 13. Tracking workflow

The platform uses these manual operational statuses:

- Ordered
- Sorting
- In Transit
- Out for Delivery
- Delivered
- Cancelled

Each milestone is stored in `tracking_logs` with timestamp, location, notes and updating user. Authorized staff update the milestones; there is no driver/rider mobile app in this build.

## 14. Security checklist before public launch

- Change both seeded passwords.
- Use a strong unique database password.
- Set `APP_DEBUG=false`.
- Keep `.env` outside public web access.
- Configure HTTPS/SSL.
- Configure SMTP rather than relying on PHP `mail()`.
- Do not expose `phpinfo()` or debugging routes.
- Confirm `storage/` and `bootstrap/cache/` have appropriate permissions.
- Review admin/staff accounts and deactivate unused accounts.
- Test document upload size/type restrictions.
- Configure backups.

## 15. Important scope note

The supplied project brief covers the courier-first corporate website, customer order/shipment requests, tracking, customer documents, staff/admin operations, CMS, invoices, notifications, six languages and GA4. It also mentions an AI chatbot on the homepage. This Laravel overlay does not silently invent a third-party chatbot provider or API key; a production chatbot integration should be configured separately with the chosen provider and credentials.
