'required|string|max_length[9]', ]; public function getLock(int $classSectionId, string $semester, string $schoolYear): ?array { if ($classSectionId <= 0 || $semester === '' || $schoolYear === '') { return null; } return $this->where('class_section_id', $classSectionId) ->where('semester', $semester) ->where('school_year', $schoolYear) ->orderBy('id', 'DESC') ->first(); } public function isLocked(int $classSectionId, string $semester, string $schoolYear): bool { $row = $this->getLock($classSectionId, $semester, $schoolYear); return !empty($row['is_locked']); } }