'date', 'complaint_date' => 'date', 'is_active' => 'boolean', 'status' => BlotterStatus::class, ]; public function complainant() { return $this->belongsTo(\App\Models\User::class, 'complainant_user_id'); } public function respondent() { return $this->belongsTo(\App\Models\User::class, 'respondent_user_id'); } public function assignedOfficer() { return $this->belongsTo(\App\Models\User::class, 'assigned_officer_id'); } public function hearings() { return $this->hasMany(BlotterHearing::class, 'blotter_id'); } public function nextHearing() { return $this->hearings()->where('status', 'SCHEDULED')->orderBy('hearing_date')->first(); } public function scopeActive($query) { return $query->where('is_active', true); } public static function generateBlotterNo(): string { $year = date('Y'); $count = static::whereYear('created_at', $year)->count() + 1; return sprintf('BLT-%s-%04d', $year, $count); } }