feat: Implement Cost Calculator module with CRUD operations and DataTables integration
This commit is contained in:
@@ -10,35 +10,25 @@ class CostCalculatorService
|
||||
{
|
||||
return CostCalculator::when($request, function ($query) use ($request) {
|
||||
if ($request->filled('country_id')) {
|
||||
$query->whereRelation('institution', 'country_id', $request->country_id);
|
||||
}
|
||||
|
||||
if ($request->filled('institution_id')) {
|
||||
$query->where("institution_id", $request->institution_id);
|
||||
$query->where('country_id', $request->country_id);
|
||||
}
|
||||
|
||||
if ($request->filled('programlevel_id')) {
|
||||
$query->where("programlevel_id", $request->programlevel_id);
|
||||
}
|
||||
|
||||
if ($request->filled('intake_id')) {
|
||||
$intakeId = $request->intake_id;
|
||||
$query->whereJsonContains('intakes', $intakeId);
|
||||
if ($request->filled('program_id')) {
|
||||
$query->where("program_id", $request->program_id);
|
||||
}
|
||||
|
||||
if ($request->filled('living_status_id')) {
|
||||
$query->where("living_status_id", $request->living_status_id);
|
||||
}
|
||||
|
||||
if ($request->filled('status')) {
|
||||
$query->where('status', $request->status);
|
||||
}
|
||||
|
||||
if ($request->filled('search')) {
|
||||
$search = $request->search;
|
||||
$query->where('title', 'like', "%{$search}%");
|
||||
}
|
||||
|
||||
if ($request->filled('location')) {
|
||||
$location = $request->location;
|
||||
$query->where('location', 'like', "%{$location}%");
|
||||
}
|
||||
})->latest()->paginate(10)->withQueryString();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user