# Content, Notifications, and Configuration Models

## Localization storage

All bilingual titles, messages, and content below are single JSON attributes declared in `$translatable`; for example, `title_ar/en` becomes the `title` JSON column. Filament uses `->translatable()` to edit the Arabic and English values.

## `ContentPage` → `content_pages`

The six populated `platform_about` rows are different page types, so use ContentPage rather than AboutPage.

Fields: `id`, unique `slug`, `title_ar/en`, `content_ar/en`, `image_path`, `icon_path`, status/audit/timestamps. Belongs to creating/updating admins.

Renames: `platform_about → content_pages`, derive `slug`, `image/icon → image_path/icon_path`, normalize bilingual/status/audit fields.

## `Advertisement` → `advertisements`

Fields: `id`, audience, sort order, home visibility, title/URL, nullable product/section/provider IDs, image, expiry, type, status/audit/timestamps.

Relationships: belongs to optional product, section, provider User, and admins.

Renames: consolidate `application_id/show_in_app → audience`, `order_view → sort_order`, `in_home → is_home_visible`, `deadline → expires_at`, `image → image_path`.

## `WelcomeSlider` → `welcome_sliders` (empty)

Fields: `id`, sort order, bilingual title/content, image, target, audience, status/audit/timestamps.

Renames: `order_view → sort_order`, `open_window → target`, `show_in_app → audience`, `image → image_path`.

## `ContactMessage` → `contact_messages` (empty)

Fields: `id`, nullable user, device fields, sender/contact fields, subject/message/type, new workflow status/assigned admin, request metadata, timestamps.

Relationships: belongs to optional user/admin.

Renames: `device_id → device_identifier`, `message_subject → subject`, `contact_type → type`, `date → created_at`, `ipaddress → ip_address`.

## `Notification` → `notifications`

Fields: `id`, nullable external ID/sender, type, nullable subject type/id, target URL, title/message, JSON payload, nullable sent time, status, timestamps.

Relationships: belongs to optional sender; has many recipients; optional controlled subject morph.

Renames: `notification_id → external_notification_id`, `sender_date → sent_at`, `item_id → subject_id`, `item_url → target_url`, `message_title → title`, merge `PostData/fields → payload`, `date → created_at`.

Move recipient-specific state out of Notification.

## `NotificationRecipient` → `notification_recipients`

Fields: `id`, notification/recipient IDs, nullable account type, encrypted push-token snapshot, nullable read/seen/delivered/failed times and failure reason, timestamps.

Relationships: belongs to notification and recipient User. Unique notification/recipient unless channel joins the key.

Renames: `accounts_type → account_type`, inverse-map `unread → read_at`, inverse-map `is_new → seen_at`; merge duplicate recipient fields from Notification.

## `ScheduledNotification` → `scheduled_notifications`

Fields: `id`, nullable user/order IDs, type/status, scheduled time, JSON payload, nullable last attempt, attempts count/failure reason, timestamps.

Relationships: belongs to optional user/order.

Renames: `send_at_date → scheduled_for`, `sendData → payload`, `CronJobsLastReadDate → last_attempt_at`.

## `Configuration` → `configurations`

Keep a singleton model initially. Field groups:

- Identity/contact, URLs, logos, phone/email/social links.
- Client/driver app versions and forced-update flags.
- Product/coupon/loyalty/wallet/order/rating feature flags.
- Working hours, order minimum, wrapping fee, driver assignment and distance delivery settings.
- Primary currency and app/provider percentages.
- Notification/email/WhatsApp integration settings.
- Encrypted secrets or environment references; never expose secrets in API output.

Representative renames: `site_stop_apps → apps_are_disabled`, `site_allow_*/site_enable_* → *_enabled`, `OrderHasDriver → driver_delivery_enabled`, `select_curreny → primary_currency_id`, `site_get_PriceOfOneLoyaltyPointint → loyalty_point_value`, `site_products_default_app_percentage → default_app_percentage`, `location_latitude/longitude → store_latitude/longitude`, `site_force_* → force_*`.

## Diagnostic models

- `SystemError`: source/details/request metadata/occurred time; empty and retention-limited.
- `SearchLog`: `keyword → term`, `visits → search_count`, `timestamp → searched_at`, `referer → referrer`; empty.
- `UserEvent`: clear JSON snapshot names for request/session/cookie/server/trace fields; empty and optional.
- No OnlineSession model; use Laravel sessions/cache.
- Investigate seven `platform_days` rows; use weekday enum/settings if they are weekdays.
