applicant-site/app/Http/Controllers/admin/PageController.php

59 lines
2.0 KiB
PHP
Raw Normal View History

2024-01-30 10:55:31 +03:00
<?php
2024-02-14 10:29:17 +03:00
namespace App\Http\Controllers\admin;
2024-01-30 10:55:31 +03:00
2024-03-13 14:44:54 +03:00
use App\Enums\ExaminationTypeEnum;
2024-02-14 10:29:17 +03:00
use App\Http\Controllers\Controller;
use App\Models\Admission;
use App\Models\Direction;
2024-03-13 14:44:54 +03:00
use App\Models\EntranceExamination;
2024-03-05 14:29:18 +03:00
use App\Models\Faculty;
2024-03-07 13:08:28 +03:00
use App\Models\Subject;
2024-01-30 10:55:31 +03:00
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
class PageController extends Controller
{
// public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
// {
// $admissions = Admission::all()->sortBy('position');
// return view('menu.reception-screen', compact('admissions'));
// }
2024-03-05 14:29:18 +03:00
public function directions()
{
$faculties = Faculty::all();
2024-03-13 14:44:54 +03:00
$subjects = EntranceExamination::all()
->select('subject_id', 'subject_type_id', 'examination_type_id')
->where('examination_type_id', '=', ExaminationTypeEnum::Ege->value)
2024-03-13 15:02:39 +03:00
->reduce(function (?array $carry, $subject) {
2024-03-13 14:44:54 +03:00
$id = $subject['subject_id'];
$value = Subject::find($id)->name;
$carry[$id] = $value;
return $carry;
2024-03-13 15:06:56 +03:00
});
$directionsWithInstitution = Direction::with(['department'])
->join('departments', 'directions.department_id', '=', 'departments.id')
->join('faculties', 'departments.faculty_id', '=', 'faculties.id')
->join(
'educational_institutions',
'faculties.educational_institution_id',
'=',
'educational_institutions.id'
)
->get([
'directions.id',
'directions.name',
"educational_institutions.name as educational_institution_name"
]);
return view('new-design.bakalavr-special', compact('faculties', 'subjects', 'directionsWithInstitution'));
2024-03-05 14:29:18 +03:00
}
2024-03-06 15:20:16 +03:00
2024-03-07 13:08:28 +03:00
2024-03-06 15:20:16 +03:00
public function calculator($request)
{
return response()->json($request);
}
2024-01-30 10:55:31 +03:00
}