How a-oirgari/fillrouge works
1. Project type and runtime
- This is a Laravel 11-style monolith for a medical teleconsultation platform called MediConnect.
- It is a server-rendered application using Blade views, not a separate SPA or API-first backend.
- The app persists data in MySQL and uses standard Laravel infrastructure for sessions, cache, jobs, and logging.
2. Top-level architecture
- The codebase is organized around three major user roles: patient, doctor, and admin.
- There is also a shared authentication layer and a shared messaging subsystem.
- The main architectural boundary is role-based access: users land in different controllers, dashboards, and data flows depending on their role.
3. HTTP entry points and routing
- All browser traffic enters through public/index.php and is routed by routes/web.php.
- The application is mostly form-driven: routes map to controller actions that return Blade templates and handle POST/PUT actions.
- routes/channels.php suggests a broadcast channel layer exists for realtime features, especially messaging/calls.
4. Presentation layer
- UI lives in resources/views, grouped by role: auth, patient, doctor, admin, and messages.
- resources/views/layouts/app.blade.php is the shared shell used across the app.
- The app uses a small frontend build pipeline (resources/js, resources/css, vite.config.js), but the architecture remains primarily Blade-centric.
5. Domain model and persistence
- The core domain is modeled with Eloquent entities: User, Patient, Doctor, Speciality, Availability, Appointment, Consultation, Prescription, and Message.
- The database schema is defined by migrations under database/migrations, including a many-to-many link between doctors and specialities.
- This model set shows the main lifecycle: doctor registration and validation, availability setup, appointment booking, consultation completion, and prescription/message history.
6. Authentication and authorization
- AuthController handles registration, login, and logout.
- Validation is enforced through dedicated Form Request classes such as LoginRequest and RegisterRequest.
- app/Http/Middleware/RoleMiddleware.php is the key access-control boundary, ensuring only the correct role reaches patient/doctor/admin routes.
- SetLocale.php is a cross-cutting middleware that switches the app language, supporting Arabic and French.
7. Patient workflow
- PatientController serves the patient dashboard, doctor search, doctor profile, appointment listing, and medical history.
- The patient flow is: browse doctors by speciality/city, inspect a doctor profile, book an appointment, then later view the resulting consultation history.
- The patient history screen aggregates past consultations and prescriptions, so it is a read-heavy view over multiple domain tables.
8. Doctor workflow
- DoctorController manages the doctor dashboard, appointment queue, consultation entry, profile editing, and patient history.
- Doctors can manage their own availability through validated forms, then accept/refuse appointments and record diagnostics/prescriptions during consultation.
- The doctor dashboard is operational: it surfaces pending requests and same-day appointments as the main work queue.
9. Admin workflow
- AdminController provides governance functions: doctor validation, user management, statistics, and speciality CRUD.
- The admin boundary is distinct from clinical workflows; it focuses on platform oversight rather than appointments or care delivery.
- The admin dashboard aggregates global counts and operational lists, including doctors waiting for approval.
10. Messaging and realtime collaboration
- MessageController powers one-to-one conversations across connected users.
- app/Events/MessageSent.php and app/Events/CallInitiated.php, together with config/reverb.php, indicate a realtime broadcasting layer for chat/call signaling.
- Even though the conversation view mentions polling in the UI, the presence of events and broadcast channels means messaging is architected as an event-driven feature with realtime capability.
11. Validation and request boundaries
- Most state-changing actions are guarded by dedicated Form Requests: appointment booking, availability saving, diagnostics, doctor profile updates, messaging, and speciality creation.
- This keeps validation out of controllers and makes each business action explicit at the boundary between HTTP and domain logic.
- The controllers therefore orchestrate workflows, while requests enforce input correctness.
12. Data flow summary
- Typical flow is: browser form/view → route → middleware (auth/role/locale) → Form Request validation → controller action → Eloquent models / database → Blade response.
- The shared database is the integration point for all role-specific features.
- Messages and calls are the only parts that extend beyond simple request/response, introducing broadcast/event behavior.
13. Internationalization and UX
- The presence of lang/ar and lang/fr shows the platform is built for bilingual use.
- Locale switching is a first-class concern, not an afterthought, because it is enforced in middleware and backed by translation files.
14. Architecture diagram takeaway
- If you draw this system, model it as a single Laravel web application with:
- a public/auth boundary,
- three role-based UI/workflow zones,
- a shared domain/database layer,
- and a realtime messaging/call side channel.
- The most important relationships are between roles → controllers → request validation → Eloquent models → Blade views, with broadcast events overlaying the messaging subsystem.
Main entry points: web.php Web routes · DoctorController.php Doctor · PatientController.php Patient · AdminController.php Admin
Components 26
Platform
Laravel runtime, entrypoints, and cross-cutting app configuration.
- Public entry · Browser entrypoint for the Laravel app.
fillRouge/public/index.php - Web routes · Main browser routing table.
fillRouge/routes/web.php - Broadcast channels · Channel definitions for broadcast features.
fillRouge/routes/channels.php
Access
Authentication, authorization, and locale boundaries.
- Auth · Login, registration, and logout.
fillRouge/app/Http/Controllers/AuthController.php - Role guard · Restricts access by user role.
fillRouge/app/Http/Middleware/RoleMiddleware.php - Locale switch · Sets Arabic/French locale context.
fillRouge/app/Http/Middleware/SetLocale.php
Workflows
Role-based controllers and Blade UI flows.
- App shell · Shared layout used across views.
fillRouge/resources/views/layouts/app.blade.php - Patient · Patient dashboard, search, booking, and history.
fillRouge/app/Http/Controllers/PatientController.php - Doctor · Doctor dashboard, queue, availability, and consultation.
fillRouge/app/Http/Controllers/DoctorController.php - Admin · Governance, validation, users, and specialities.
fillRouge/app/Http/Controllers/AdminController.php - Messages · One-to-one conversations and call actions.
fillRouge/app/Http/Controllers/MessageController.php - Patient views · Patient screens for search, booking, and history.
fillRouge/resources/views/patient - Doctor views · Doctor screens for workflow and consultation.
fillRouge/resources/views/doctor - Admin views · Admin dashboards and management screens.
fillRouge/resources/views/admin - Chat views · Conversation and call UI.
fillRouge/resources/views/messages
Domain
Core persistence models and realtime messaging.
- User · Shared authenticated account record.
fillRouge/app/Models/User.php - Patient · Patient profile and history anchor.
fillRouge/app/Models/Patient.php - Doctor · Doctor profile, validation, and availability.
fillRouge/app/Models/Doctor.php - Speciality · Doctor classification and search dimension.
fillRouge/app/Models/Speciality.php - Appointment · Booking and scheduling record.
fillRouge/app/Models/Appointment.php - Consultation · Clinical encounter and diagnostics.
fillRouge/app/Models/Consultation.php - Prescription · Medication and treatment output.
fillRouge/app/Models/Prescription.php - Message · Conversation message record.
fillRouge/app/Models/Message.php - MessageSent · Broadcasts chat message delivery.
fillRouge/app/Events/MessageSent.php - CallInitiated · Broadcasts call signaling.
fillRouge/app/Events/CallInitiated.php - Reverb · Realtime broadcasting configuration.
fillRouge/config/reverb.php
Connections 36
- Public entry → Web routes: dispatches to · HTTP requests are routed through the web router.
- Web routes → Locale switch: applies · Locale handling is applied at the web boundary.
- Web routes → Role guard: protects · Role-based access controls role routes.
- Web routes → Auth: auth routes · Login and registration enter the auth controller.
- Web routes → Patient: patient flow · Patient actions are routed to patient workflows.
- Web routes → Doctor: doctor flow · Doctor actions are routed to doctor workflows.
- Web routes → Admin: admin flow · Admin actions are routed to governance workflows.
- Web routes → Messages: messaging · Conversation and call actions are routed here.
- Broadcast channels → MessageSent: broadcasts · Channel layer supports message events.
- Broadcast channels → CallInitiated: broadcasts · Channel layer supports call signaling.
- Auth → User: creates accounts · Authentication works through the shared user record.
- Auth → Patient: creates patient · Registration can provision patient profile data.
- Auth → Doctor: creates doctor · Registration can provision doctor profile data.
- Patient → Patient views: renders · Patient screens are Blade-rendered.
- Patient → Appointment: books · Patient booking centers on appointments.
- Patient → Consultation: reads history · Patient history aggregates consultations.
- Patient → Prescription: reads history · Patient history includes prescriptions.
- Doctor → Doctor views: renders · Doctor screens are Blade-rendered.
- Doctor → Doctor: updates profile · Doctor workflows maintain doctor data.
- Doctor → Appointment: manages queue · Doctor work queue is appointment-driven.
- Doctor → Consultation: records care · Consultations store diagnostics and outcomes.
- Doctor → Prescription: writes prescriptions · Clinical completion produces prescriptions.
- Admin → Admin views: renders · Admin screens are Blade-rendered.
- Admin → User: manages users · Administration covers platform user oversight.
- Admin → Doctor: validates doctors · Admin approves or rejects doctors.
- Admin → Speciality: crud · Admin manages specialities.
- Messages → Chat views: renders · Messaging UI is Blade-rendered.
- Messages → Message: stores · Conversation data persists as messages.
- Messages → MessageSent: emits · New messages trigger broadcast events.
- Messages → CallInitiated: emits · Call actions trigger signaling events.
- MessageSent → Reverb: broadcast via · Realtime delivery uses Reverb config.
- CallInitiated → Reverb: broadcast via · Call signaling uses Reverb config.
- Patient views → App shell: extends · Patient views share the common shell.
- Doctor views → App shell: extends · Doctor views share the common shell.
- Admin views → App shell: extends · Admin views share the common shell.
- Chat views → App shell: extends · Messaging views share the common shell.