# Legacy Disposition and Generation Checklist

## Tables not mapped one-to-one

| Legacy tables | Decision |
|---|---|
| `platform_admins_permissions` | No custom model; use Spatie roles/permissions |
| `platform_logs` | No AdminAuditLog model; migrate suitable records to Spatie Activitylog |
| Singular geography/governorate/district views | Country, City and Zone models only |
| `platform_cobons*` | Empty obsolete spelling; omit |
| Provider product count table | Derived query/cache; omit |
| Order/item/payment temporary tables | CheckoutSession/PaymentAttempt only if required |
| Five payment-location pivots | Consolidate into PaymentMethodAvailability |
| Three loyalty transaction/trigger tables | Consolidate into immutable LoyaltyEntry |
| `platform_online` | Laravel session/cache presence |
| `platform_news_users_events` | Empty/unclear; omit until identified |

## Implementation priority

P0 populated/live:

- Admin/User/UserDevice plus Spatie Permission and Activitylog.
- Currency/Country/City/Zone/AddressType/Address/DeliveryTime.
- Category/Product/Favorite.
- Order/Item/Delivery/StatusEvent/AuditEvent.
- PaymentMethod, Coupon/Redemption, WalletEntry.
- Rating models.
- ContentPage/Advertisement/Notification/Recipient/ScheduledNotification/Configuration.

P2 requiring confirmation because source tables are empty:

- Brand, image/variant/related-product models.
- Provider product/category pivots.
- Payment availability/history.
- Loyalty models.
- Slider, contact, evaluation and diagnostics.

## Per-model generation checklist

1. Approve its domain review file and semantic decisions.
2. Create migration with types, nullability, indexes, constraints and delete behavior.
3. Create model with explicit attributes, sensitive-field hiding, casts, enum casts and typed relationships.
4. Create factory states.
5. Create/register policy and workflow abilities.
6. Create Filament resource/relation managers when applicable.
7. Create Form Requests/API Resources when API-facing.
8. Create importer with every documented rename/transformation.
9. Add Pest tests for behavior, transformations, authorization, validation and workflow invariants.
10. Run narrow tests, Pint and project checks before the next group.

## Spatie Permission checklist

1. Obtain approval to add the dependency.
2. Verify/install the Laravel 13 and PHP 8.5 compatible version.
3. Publish/review config and migrations.
4. Add `HasRoles` to Admin and configure `admin` guard.
5. Define permissions by resource/workflow action, not legacy page number.
6. Seed an approved role matrix.
7. Map legacy super admins to the designated Spatie role and add policy tests for that role.
8. Build Filament role/permission management with package models; never duplicate them.

## Spatie Activitylog checklist

1. Obtain approval to add `spatie/laravel-activitylog`.
2. Verify/install the Laravel 13 and PHP 8.5 compatible version.
3. Publish and review package configuration/migration.
4. Define auditable models, events, and explicit safe attribute lists.
5. Map resolvable legacy log rows to the package Activity model and store residual context in properties.
6. Add a read-only, permission-protected Filament activity viewer.
7. Test actor/subject/event/properties capture, sensitive-field exclusion, authorization, and pruning.
