forked from aslan/applicant-site
fix calculator
This commit is contained in:
parent
27cbb5d8cf
commit
1743d10289
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue