for view faculty
Tests & Lint & Deploy to Railway / build (2.6.6, 20.x, 8.3) (push) Failing after 1m48s Details
Tests & Lint & Deploy to Railway / deploy (push) Has been skipped Details

This commit is contained in:
aslan 2024-03-05 14:29:18 +03:00
parent c4caf84226
commit b3d4231ec8
4 changed files with 632 additions and 486 deletions

10
app/Enums/FacultyEnum.php Normal file
View File

@ -0,0 +1,10 @@
<?php
namespace App\Enums;
enum FacultyEnum: int
{
case InfBez = 1;
case Spo = 2;
case Magistracy = 3;
}

View File

@ -2,11 +2,15 @@
namespace App\Http\Controllers\admin;
use App\Enums\FacultyEnum;
use App\Http\Controllers\Controller;
use App\Models\Admission;
use App\Models\Direction;
use App\Models\Faculty;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\DB;
class PageController extends Controller
{
@ -15,4 +19,30 @@ class PageController extends Controller
$admissions = Admission::all()->sortBy('position');
return view('menu.reception-screen', compact('admissions'));
}
public function directions()
{
// $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();
$faculties = Faculty::all();
// $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) {
//
// }
// }
//
// }
return view('new-design.bakalavr-special', compact('faculties'));
}
}

File diff suppressed because it is too large Load Diff

View File

@ -11,9 +11,7 @@ Route::get('/magistr', function () {
return view('new-design.magistr');
})->name('magistr');
Route::get('/home', function () {
return view('new-design.bakalavr-special');
})->name('home');
Route::get('/home', [PageController::class, 'directions'])->name('home');
Route::get('/', function () {
return view('new-design.bakalavr-special');