whereHas('admissionSchedule', fn ($query) => $query ->whereRelationUlid('admissionTrack', $admissionTrack) ->whereHas('term', fn ($query) => $query->where('name', $termEntry)) ) ->whereRelationUlid('academicProgram', $academicProgram) ->whereRelationUlid('studyProgram', $studyProgram) ->whereRelationUlid('feeType', $feeType) ->select(['amount', 'id']) ->first(); if(is_null($fee)) { throw new Exception(__('domains/admission/exception.fee_rate_not_found')); } return $fee; } }