add directionsWithInstitution to new-design.bakalavr-special

This commit is contained in:
aslan 2024-03-18 15:22:06 +03:00
parent 16785b5698
commit c3eed199ac
1 changed files with 21 additions and 6 deletions

View File

@ -5,6 +5,7 @@ namespace App\Http\Controllers\admin;
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;
@ -14,11 +15,11 @@ 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'));
}
// public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
// {
// $admissions = Admission::all()->sortBy('position');
// return view('menu.reception-screen', compact('admissions'));
// }
public function directions()
{
@ -32,7 +33,21 @@ class PageController extends Controller
$carry[$id] = $value;
return $carry;
});
return view('new-design.bakalavr-special', compact('faculties', 'subjects'));
$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'));
}