# Phase 3 — Categories, Products, Inventory

Same deal as Phase 2: copy these files into your `showroom/` project
(overwrite `routes/web.php`, `resources/views/layouts/app.blade.php`,
`resources/lang/bn/app.php`, `resources/lang/en/app.php`, and
`database/seeders/DatabaseSeeder.php`), then:

```bash
php artisan migrate
php artisan db:seed --class=CategorySeeder
php artisan db:seed --class=ProductSeeder
```

(Or `php artisan migrate:fresh --seed` to rebuild everything from scratch —
`DatabaseSeeder` now calls all seeders including these two.)

## What's in Phase 3

- **Categories**: self-referencing (optional parent), Bangla+English names,
  Admin/Super-Admin only — enforced by `CategoryPolicy`. Inline
  create/edit modal on the index page; delete blocked while products
  still reference the category.
- **Products**: full field set from Phase 1's schema, search (name/SKU/
  barcode/serial), category + stock filters, pagination. Staff can add/
  edit (`products.manage` permission) but not delete
  (`products.delete` — Admin/Super Admin only by default, per the
  seeded permission set).
- **Inventory — the important part**: `Product::stock_quantity` is a
  cached column, but **nothing writes to it directly**. Every change —
  opening stock on creation, manual corrections — goes through
  `InventoryService::move()`, which runs inside a locked DB transaction
  and always leaves a row in `inventory_transactions` with a reason,
  the resulting stock level, and who did it. Sales/purchases/returns in
  later phases will call the same service, so the history stays
  complete and correct by construction, not by convention.
- Stock adjustment on the product page requires a reason — there's no
  way to just edit the number.
- Low-stock and out-of-stock views under **Inventory**, plus a full
  transaction log filterable by product/type.
- Product images: multi-upload, first one becomes primary automatically.

## Note

`Category::name_en` generates the `slug`; if you rename a category later
the slug updates too (uniqueness is still enforced, ignoring the row
being edited).

## Next

Say "Phase 4" for Customers and Suppliers.
