# Services: Everything Else

All under `app/Services/`.

## Chat

**`ConversationService`**

| Method | Does |
|---|---|
| `typesFor(Order)` | Which conversation types an order should currently have |
| `getOrderConversations(Order, User)` | Lazily creates missing threads, returns caller's threads with unread state |
| `getConversation(Conversation, User)` / `getMessages(Conversation)` | Single-thread lookups |
| `markAsRead(Conversation, User)` | Updates the pivot's `last_read_at` |
| `sendMessage(Conversation, User, ?body, ?attachment, ?duration)` | Stores the message, broadcasts `MessageSentEvent`, notifies other participants |

## Notifications

**`NotificationService`** — `saveDriverNotification`, `saveAdminNotification`,
`clientNotificationDeclineOrder`, `clientNotificationAcceptOrder`, `read()`, `delete()`. Writes to
the polymorphic `notifications` table.

## Restaurant & catalog

| Service | Handles |
|---|---|
| `RestaurantService` | Profile, availability, opening hours, overview/dashboard stats, wallet, gallery images, landing page data, status (activate/deactivate), search/filter/nearby |
| `RestaurantUserService` | Staff pivot CRUD: `getStaff`, `assignUser`, `removeUser`, `updateRole` |
| `ProductService` | `saveProduct`/`updateProduct` (incl. image/gallery uploads), `updateAvailability`, `getProductById`, `getBestSellers`, `getBestReviewed`, `productSearch`, `filterProducts`, `getProducts` |
| `CategoryService` | `getCategories`, `createCategory`, `updateCategory`, `deleteCategory` |
| `ThemeService` | `getRestaurantTheme`, `updateTheme`, `resetTheme` |
| `SliderService` | Slider CRUD + activation |
| `SubscriptionService` | `getSubscriptions(User)` |
| `ReviewService` | Reviews for restaurant / product / driver |
| `StateService` | `states()`, `cities(array)` |

## Settings

**`SettingsService`** — `getSettings`, `updateSettings`, `updatePricing`,
`updateDispatchSettings`, `updateTimeouts`, `updateDemandFee`, `createPeakHour`/`updatePeakHour`,
`updateMedia`. Reads the current restaurant off the request/auth context. Outside an HTTP request
(a job, a command), use `Setting::forRestaurant($id)` directly instead — same as
`TransactionService` and `DriverProximityService` already do.

## Driver & auth

| Service | Handles |
|---|---|
| `DriverService` | `updateDriverLocation`, `updateDriverWorkStatus`, `updateDriverProfile`, `driverStatus` (restaurant approves/refuses a submission), `getRestaurantDrivers`, `createDriver`, `getTransactions` (their `wallet_transactions`, not a wallet — see [DATABASE_SCHEMA.md](../../DATABASE_SCHEMA.md)) |
| `AuthService` | Login per role (issues Sanctum tokens for mobile), password reset flow, `getMe()`, FCM token registration, terms acceptance. Not what the Livewire panel's own login uses — see [06-tenancy-permissions-policies.md](06-tenancy-permissions-policies.md) |
| `HelperService` | `driverCheck(Driver)` / `restaurantCheck(int $restaurantId)` — guard-clause checks used across the API controllers |

## Reporting / export

`AnalyticsService` (dashboard chart data — revenue, GMV, customer retention/growth/LTV, already
used by the existing `app/Livewire/Pages/Dashboard/*` pages), `ExportService`/`PrintService`
(Excel/PDF generation, already wired into the existing admin panel), `GoogleMapsService`
(directions/distance/geocoding/autocomplete), `UsersService` (admin user CRUD).
