# Manpower ERP — Fresh Install Guide

This is the complete, current Manpower ERP application: recruitment, employer portal, finance,
double-entry accounting, HRM & Kenyan payroll, and inventory. This guide sets it up from
absolutely nothing — a brand-new server, a brand-new database, no prior files.

## What you need first
- PHP 8.2 or newer, with these extensions: pdo_mysql, mbstring, openssl, fileinfo, gd (for the
  logo/favicon on generated PDFs — optional but recommended)
- Composer (https://getcomposer.org)
- A MySQL or MariaDB database, created empty, with a username/password that can read and write it
- Somewhere to run PHP: shared hosting (cPanel), a VPS, or your own machine for testing

## Step 1 — Create a fresh Laravel project
In a terminal, in the folder where you want the project to live:

    composer create-project laravel/laravel manpower-erp
    cd manpower-erp

This downloads Laravel itself (the framework core) and its dependencies. It only needs to be done
once — everything in this zip is layered on top of it.

## Step 2 — Copy in the Manpower ERP files
Extract this zip and copy **all** of its contents into the `manpower-erp` folder you just created,
overwriting any files with the same name. The important ones it replaces are:

    bootstrap/app.php
    app/Providers/AppServiceProvider.php
    routes/web.php
    routes/console.php

Everything else (the `app/Http/Controllers`, `app/Support`, `database/migrations` and
`resources/views` folders) is new — none of it exists in a stock Laravel install.

Do **not** copy over your own `.env` file or `vendor/` folder if you're re-running this on an
existing project — only do that when setting up somewhere genuinely new.

## Step 3 — Point your web server at `public/`
- **cPanel / shared hosting:** either set the domain's document root to the `manpower-erp/public`
  folder (cleanest — the site then opens with no `/public` in the address), or upload the whole
  `manpower-erp` folder as-is and open `https://yourdomain.com/public/install` to start.
- **Your own machine, for testing:** run `php artisan serve` from inside `manpower-erp` and open
  `http://localhost:8000/install`.

## Step 4 — Run the installer
Open `/install` in a browser and follow the three steps:

1. **Requirements** — confirms PHP and the required extensions are in place.
2. **Database** — enter your empty database's host, name, username and password. This writes your
   `.env` file and creates every table the system needs, in the correct order, in one go.
3. **Company & administrator** — set your company name and create the first admin login.

The installer locks itself once finished. To re-run it later (only ever needed if you are
deliberately starting over), delete `storage/app/installed` on the server.

## Step 5 — First things to check once you're in
- Sign in as the admin account you just created.
- Go to **Settings → Company** to set your logo, favicon, contact details and currency.
- Go to **Settings → Payment details** to add your bank/M-Pesa details, shown on every invoice.
- Go to **Settings → Payroll** and double-check the Kenyan statutory rates (PAYE bands, NSSF,
  SHIF, Housing Levy, NITA) against current KRA/NSSF guidance before running real payroll — these
  are stored as editable settings precisely because they change.
- If you want SMS/WhatsApp/email notifications, set those up under **Settings → Notifications**
  and **Settings → Email**.
- Optional: add the one-line cron command shown under **Settings → System** so expiry reminders
  send themselves daily, rather than needing a manual click.

## Updating this install later
Whenever you're given a newer version of these files, copy them over the same way (Step 2), then:

1. Reload any page once — the database updates itself automatically.
2. Sign in as admin, go to **Settings → System**, and click **Clear cache**.
3. Check the **Deployment check** panel on that same page — it reads the actual files on your
   server and confirms whether each key file is the current version. If anything shows as an old
   version, that file didn't get overwritten; re-copy it directly.

## Roles, in brief
- **Admin** — everything.
- **User** — recruitment, finance, reports; not accounting, HRM/payroll, inventory, users or settings.
- **Finance** — finance, accounting, HRM/payroll, inventory, invoices, reports; not candidates or employers.
- **Front desk** — register candidates, upload documents, record a transaction (goes to Finance for approval).
- **Employer** — their own portal only: their candidates, requests and invoices.
