You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.0 KiB
37 lines
1.0 KiB
<?php
|
|
|
|
namespace App\Domains\Admission\Queries;
|
|
|
|
use App\Domains\Admission\Models\FeeRate;
|
|
use Exception;
|
|
|
|
class SearchAdmissionSchedulePricing
|
|
{
|
|
/**
|
|
* @throws Exception
|
|
*/
|
|
public static function fetch(
|
|
string $admissionTrack,
|
|
string $academicProgram,
|
|
string $studyProgram,
|
|
string $termEntry,
|
|
string $feeType): ?FeeRate
|
|
{
|
|
$fee = FeeRate::query()
|
|
->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;
|
|
}
|
|
}
|
|
|