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

57 lines
1.8 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-05 14:29:18 +03:00
use App\Enums\FacultyEnum;
2024-02-14 10:29:17 +03:00
use App\Http\Controllers\Controller;
use App\Models\Admission;
2024-03-05 14:29:18 +03:00
use App\Models\Direction;
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;
2024-03-05 14:29:18 +03:00
use Illuminate\Support\Facades\DB;
2024-01-30 10:55:31 +03:00
class PageController extends Controller
{
public function index(): View|Application|Factory|\Illuminate\Contracts\Foundation\Application
{
2024-02-14 10:29:17 +03:00
$admissions = Admission::all()->sortBy('position');
return view('menu.reception-screen', compact('admissions'));
2024-01-30 10:55:31 +03:00
}
2024-03-05 14:29:18 +03:00
public function directions()
{
2024-03-07 13:08:28 +03:00
// $directions = DB::table('faculties')
// ->join('departments', 'faculties.id', '=', 'departments.faculty_id')
// ->join('directions', 'departments.id', '=', 'directions.department_id')
// ->select('faculties.name as faculties.name', 'directions.name', 'directions.id')
// ->groupBy('faculties.name')
// ->get();
2024-03-05 14:29:18 +03:00
$faculties = Faculty::all();
2024-03-07 13:08:28 +03:00
$subjects = Subject::pluck('name', 'id');
2024-03-05 14:29:18 +03:00
// $infBez = $faculties->find(FacultyEnum::InfBez->value);
// $query = `select faculties.name, directions.name, directions.id
//FROM faculties
//join departments on faculties.id = departments.faculty_id
//join directions on departments.id = directions.department_id`;
// $directions = DB::($query);
// foreach ($faculties as $faculty) {
// foreach ($faculty->departments as $department) {
// foreach ($department->directions as $direction) {
//
// }
// }
//
// }
2024-03-07 13:08:28 +03:00
return view('new-design.bakalavr-special', compact('faculties', 'subjects'));
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
}