fix calculator
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (push) Successful in 1m47s Details
Tests & Lint & Deploy to Railway / deploy (push) Successful in 32s Details

This commit is contained in:
aslan 2024-03-13 14:44:54 +03:00
parent 27cbb5d8cf
commit 1743d10289
1 changed files with 17 additions and 4 deletions

View File

@ -2,16 +2,15 @@
namespace App\Http\Controllers\admin;
use App\Enums\FacultyEnum;
use App\Enums\ExaminationTypeEnum;
use App\Http\Controllers\Controller;
use App\Models\Admission;
use App\Models\Direction;
use App\Models\EntranceExamination;
use App\Models\Faculty;
use App\Models\Subject;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\DB;
class PageController extends Controller
{
@ -30,7 +29,21 @@ class PageController extends Controller
// ->groupBy('faculties.name')
// ->get();
$faculties = Faculty::all();
$subjects = Subject::pluck('name', 'id');
$subjects = EntranceExamination::all()
->select('subject_id', 'subject_type_id', 'examination_type_id')
->where('examination_type_id', '=', ExaminationTypeEnum::Ege->value)
->groupBy('subject_type_id')->map(function ($examinate) {
return $examinate->reduce(function (?array $carry, $subject) {
$id = $subject['subject_id'];
$value = Subject::find($id)->name;
$carry[$id] = $value;
return $carry;
});
})
->toArray();
dd($subjects);
// $subjects = EntranceExamination::pluck('name', 'id');
// $infBez = $faculties->find(FacultyEnum::InfBez->value);
// $query = `select faculties.name, directions.name, directions.id
//FROM faculties