'integer', 'customer_id' => 'integer', 'tailor_id' => 'integer', 'total_price' => 'decimal:2', 'appointment_date' => 'date', 'appointment_time' => 'datetime:H:i', 'completion_date' => 'date', 'measurements' => 'array', 'repair_details' => 'array', 'accepted_at' => 'datetime', 'rejected_at' => 'datetime', 'completed_at' => 'datetime', 'pickup_date' => 'date' ]; /** * Get the customer that owns the booking. */ public function customer() { return $this->belongsTo(User::class, 'customer_id'); } /** * Get the tailor that owns the booking. */ public function tailor() { return $this->belongsTo(User::class, 'tailor_id'); } /** * Get the ratings for the booking. */ public function ratings() { return $this->hasMany(TailorRating::class); } /** * Check if booking can be cancelled */ public function canBeCancelled() { return $this->status === 'reservasi'; } /** * Check if booking can be processed */ public function canBeProcessed() { return $this->status === 'reservasi' && $this->payment_status === 'paid'; } /** * Check if booking can be marked as completed */ public function canBeCompleted() { return $this->status === 'diproses'; } }