# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview Libra Law Firm is a bilingual (Arabic/English) web platform for managing client consultations, appointments, and case tracking. It serves as both a public-facing website and an internal management tool. **Domain:** libra.ps ## Development Commands ```bash # Initial setup (install deps, create .env, migrate, build assets) composer run setup # Start development (server, queue, logs, vite in parallel) composer run dev # Run all tests composer run test # Run specific test file php artisan test tests/Feature/Auth/AuthenticationTest.php # Run tests matching a filter php artisan test --filter=testName # Build frontend assets npm run build # Format PHP code vendor/bin/pint --dirty # Create new Volt component with test php artisan make:volt pages/component-name --pest # Create model with migration and factory php artisan make:model ModelName -mf ``` ## Architecture ### Technology Stack - **Backend:** Laravel 12, PHP 8.4, Laravel Fortify (auth) - **Frontend:** Livewire 3, Volt (single-file components), Flux UI Free, Tailwind CSS 4 - **Database:** SQLite (dev), MariaDB (production) - **Testing:** Pest 4 ### Key Directories - `resources/views/livewire/` - Volt single-file components (class-based pattern) - `resources/views/components/` - Reusable Blade components - `app/Actions/Fortify/` - Authentication business logic - `app/Providers/FortifyServiceProvider.php` - Custom auth views - `app/Enums/` - UserType, UserStatus, ConsultationType, ConsultationStatus, PaymentStatus, TimelineStatus, PostStatus - `docs/prd.md` - Full product requirements document - `docs/architecture.md` - Complete architecture document - `docs/stories/` - User story specifications ### Services - `app/Services/AvailabilityService.php` - Calculates available time slots for bookings - `app/Services/CalendarService.php` - Generates iCalendar files for consultations - `app/Services/CaptchaService.php` - Math-based captcha for guest booking spam protection ### Domain Model Core models in `app/Models/`: - **User** - Three types: `admin`, `individual` (client), `company` (client) - **Consultation** - Booking requests between clients and admin - **Timeline** - Case tracking for clients - **TimelineUpdate** - Updates within a timeline - **WorkingHour** - Admin's available hours for booking - **BlockedTime** - Time slots blocked from booking - **Post** - Blog/legal content articles - **Notification** - User notifications - **AdminLog** - Audit logging for admin actions ### Route Structure ``` / - Public home /booking - Consultation booking /posts - Public posts/blog /language/{locale} - Language switch (ar/en) /admin/* - Admin dashboard (requires admin middleware) /client/* - Client dashboard /settings/* - User settings (profile, password, 2FA, appearance) ``` ### Middleware - `admin` - Ensures user is admin (`EnsureUserIsAdmin`) - `client` - Ensures user is a client (`EnsureUserIsClient`) - `active` - Ensures user account is active (`EnsureUserIsActive`) - `SetLocale` - Sets language from session/user preference ### Authentication (Fortify) All auth is handled via Fortify with custom Volt views. Features enabled: - Email verification, Password reset, Profile/password updates - Two-factor authentication with QR codes and recovery codes - Note: Public registration is disabled; admin creates all client accounts ### Volt Component Pattern This project uses **class-based** Volt components: ```php name = Auth::user()->name; } public function save(): void { // ... } }; ?>