|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Database\Seeders; |
| 4 | + |
| 5 | +use App\Modules\Appointments\Models\Appointment; |
| 6 | +use App\Modules\Appointments\Models\AppointmentSlot; |
| 7 | +use App\Modules\Appointments\Models\AppointmentType; |
| 8 | +use App\Modules\Core\Models\Tenant; |
| 9 | +use Illuminate\Database\Seeder; |
| 10 | + |
| 11 | +class AppointmentsSeeder extends Seeder |
| 12 | +{ |
| 13 | + public function run(): void |
| 14 | + { |
| 15 | + $tenant = Tenant::first(); |
| 16 | + |
| 17 | + if (! $tenant) { |
| 18 | + return; |
| 19 | + } |
| 20 | + |
| 21 | + // Appointment Types |
| 22 | + $consultation = AppointmentType::create([ |
| 23 | + 'tenant_id' => $tenant->id, |
| 24 | + 'name' => 'Initial Consultation', |
| 25 | + 'description' => 'First meeting with a new client to assess needs', |
| 26 | + 'duration_minutes' => 60, |
| 27 | + 'location' => 'Meeting Room A', |
| 28 | + 'max_capacity' => 1, |
| 29 | + 'is_active' => true, |
| 30 | + 'color' => '#3B82F6', |
| 31 | + ]); |
| 32 | + |
| 33 | + $followUp = AppointmentType::create([ |
| 34 | + 'tenant_id' => $tenant->id, |
| 35 | + 'name' => 'Follow-Up Session', |
| 36 | + 'description' => 'Ongoing support session for existing clients', |
| 37 | + 'duration_minutes' => 30, |
| 38 | + 'location' => 'Meeting Room B', |
| 39 | + 'max_capacity' => 1, |
| 40 | + 'is_active' => true, |
| 41 | + 'color' => '#10B981', |
| 42 | + ]); |
| 43 | + |
| 44 | + // Appointment Slots |
| 45 | + $slot1 = AppointmentSlot::create([ |
| 46 | + 'tenant_id' => $tenant->id, |
| 47 | + 'appointment_type_id' => $consultation->id, |
| 48 | + 'start_at' => '2026-07-01 09:00:00', |
| 49 | + 'end_at' => '2026-07-01 10:00:00', |
| 50 | + 'capacity' => 1, |
| 51 | + 'booked_count' => 1, |
| 52 | + 'is_available' => false, |
| 53 | + ]); |
| 54 | + |
| 55 | + $slot2 = AppointmentSlot::create([ |
| 56 | + 'tenant_id' => $tenant->id, |
| 57 | + 'appointment_type_id' => $consultation->id, |
| 58 | + 'start_at' => '2026-07-02 14:00:00', |
| 59 | + 'end_at' => '2026-07-02 15:00:00', |
| 60 | + 'capacity' => 1, |
| 61 | + 'booked_count' => 0, |
| 62 | + 'is_available' => true, |
| 63 | + ]); |
| 64 | + |
| 65 | + $slot3 = AppointmentSlot::create([ |
| 66 | + 'tenant_id' => $tenant->id, |
| 67 | + 'appointment_type_id' => $followUp->id, |
| 68 | + 'start_at' => '2026-07-03 11:00:00', |
| 69 | + 'end_at' => '2026-07-03 11:30:00', |
| 70 | + 'capacity' => 2, |
| 71 | + 'booked_count' => 1, |
| 72 | + 'is_available' => true, |
| 73 | + ]); |
| 74 | + |
| 75 | + // Appointments |
| 76 | + Appointment::create([ |
| 77 | + 'tenant_id' => $tenant->id, |
| 78 | + 'appointment_slot_id' => $slot1->id, |
| 79 | + 'appointment_type_id' => $consultation->id, |
| 80 | + 'customer_name' => 'Sarah Johnson', |
| 81 | + 'customer_email' => 'sarah.johnson@example.com', |
| 82 | + 'customer_phone' => '+1-555-0101', |
| 83 | + 'notes' => 'Referred by existing client. Interested in premium tier.', |
| 84 | + 'status' => 'confirmed', |
| 85 | + 'confirmed_at' => '2026-06-28 10:00:00', |
| 86 | + ]); |
| 87 | + |
| 88 | + Appointment::create([ |
| 89 | + 'tenant_id' => $tenant->id, |
| 90 | + 'appointment_slot_id' => $slot3->id, |
| 91 | + 'appointment_type_id' => $followUp->id, |
| 92 | + 'customer_name' => 'Michael Torres', |
| 93 | + 'customer_email' => 'michael.torres@example.com', |
| 94 | + 'customer_phone' => '+1-555-0202', |
| 95 | + 'notes' => 'Monthly check-in.', |
| 96 | + 'status' => 'pending', |
| 97 | + ]); |
| 98 | + } |
| 99 | +} |
0 commit comments