violation = $violation; $this->data = [ 'id' => $violation->id, 'student_name' => $violation->student->full_name, 'student_nisn' => $violation->student->nisn, 'class_name' => $violation->student->class_name, 'violation_type' => $violation->violationType->name, 'category_color' => $violation->violationType->category->color ?? '#ef4444', 'points' => $violation->points, 'total_points' => $violation->student->total_points, 'time' => $violation->created_at->diffForHumans(), 'url' => route('violations.show', $violation->id), ]; } public function broadcastOn(): array { return [ new Channel('violations'), ]; } public function broadcastAs(): string { return 'violation.recorded'; } }