add Period resource

This commit is contained in:
aslan 2024-02-26 14:20:16 +03:00
parent afcdd940dd
commit 74d0c8f678
4 changed files with 117 additions and 13 deletions

View File

@ -54,6 +54,19 @@ class DirectionController extends Controller
$department = $direction->department; $department = $direction->department;
$faculty = Faculty::find($department->faculty->id); $faculty = Faculty::find($department->faculty->id);
$educationalInstitution = $faculty->educationalInstitution; $educationalInstitution = $faculty->educationalInstitution;
$ege = $direction->entranceExaminations->where('examination_type_id', '=', '1')->pluck('scores', 'subject_id');
$spo = $direction->entranceExaminations->where('examination_type_id', '=', '2')->pluck('scores', 'subject_id');
$magistracy = $direction
->entranceExaminations
->where('examination_type_id', '=', '3')
->pluck('scores', 'subject_id');
$budget = $direction->places->where('place_type_id', '=', '1')->pluck('amount', 'education_form_id');
$paid = $direction->places->where('place_type_id', '=', '2')->pluck('amount', 'education_form_id');
$costs = $direction->costs->pluck('cost', 'education_form_id');
return view( return view(
'admin.catalog.direction.show', 'admin.catalog.direction.show',
compact( compact(
@ -61,6 +74,12 @@ class DirectionController extends Controller
'educationalInstitution', 'educationalInstitution',
'faculty', 'faculty',
'department', 'department',
'ege',
'spo',
'magistracy',
'budget',
'paid',
'costs',
) )
); );
} }

View File

@ -54,4 +54,9 @@ class Direction extends Model
{ {
return $this->hasMany('App\Models\DirectionProfile', 'direction_id'); return $this->hasMany('App\Models\DirectionProfile', 'direction_id');
} }
public function periods(): HasMany
{
return $this->hasMany('App\Models\Period', 'direction_id');
}
} }

View File

@ -1,3 +1,7 @@
@php
use App\Models\Subject;
use App\Models\EducationForm;
@endphp
@extends('layouts.admin_layout') @extends('layouts.admin_layout')
@section('content') @section('content')
@auth() @auth()
@ -13,20 +17,96 @@
</h6> </h6>
<div class="container mt-4"> <div class="container mt-4">
<h2>Название</h2> <h2>Название направления подготовки</h2>
<p>{{ $direction->name }}</p> <p>{{ $direction->name }}</p>
<h2>Описание</h2>
<p>{{ $direction->description }}</p>
<h2>Позиция</h2>
<p>{{ $direction->position }}</p>
<h2>URL</h2>
<p>{{ $direction->slug }}</p>
<h2>Кафедра</h2>
<p><a href="{{ route('departments.show', $department) }}">{{ $department->name }}</a></p>
<h2>Уровень Образования</h2> <h2>Уровень Образования</h2>
<p><a href="{{ route('education_levels.show', $direction->educationLevel) }}">{{ $direction->educationLevel->name }}</a></p> <p>
<h2>Форма Образования</h2> <a href="{{ route('education_levels.show', $direction->educationLevel) }}">{{ $direction->educationLevel->name }}</a>
<p><a href="{{ route('education_forms.show', $direction->educationForm) }}">{{ $direction->educationForm->name }}</a></p> </p>
<h2>Форма обучения</h2>
<p>
<a href="{{ route('education_forms.show', $direction->educationForm) }}">{{ $direction->educationForm->name }}</a>
</p>
@if(count($ege) !== 0)
<h2>
Вступительные испытания по ЕГЭ (Минимальное количество баллов)
</h2>
@foreach($ege as $subject_id => $scores)
@php
$subject = (new Subject())->find($subject_id);
@endphp
<p>{{ $subject->name }} - {{ $scores }}</p>
@endforeach
@endif
@if(count($spo) !== 0)
<h2>
Профильные вступительные испытания, проводимые в МГТУ для поступающих на базе СПО
</h2>
@foreach($spo as $subject_id => $scores)
@php
$subject = (new Subject())->find($subject_id);
@endphp
<p>{{ $subject->name }} - {{ $scores }}</p>
@endforeach
@endif
@if(count($magistracy) !== 0)
<h2>
Вступительные испытания для Магистратуры
</h2>
@foreach($spo as $subject_id => $scores)
@php
$subject = (new Subject())->find($subject_id);
@endphp
<p>{{ $subject->name }} - {{ $scores }}</p>
@endforeach
@endif
<h2>
Количество бюджетных мест
</h2>
@foreach($budget as $education_form_id => $amount)
@php
$educationForm = (new EducationForm())->find($education_form_id);
@endphp
<p>{{ $educationForm->name }} - {{ $amount }}</p>
@endforeach
<h2>
Количество мест по договорам об оказании платных обр. услуг
</h2>
@foreach($paid as $education_form_id => $amount)
@php
$educationForm = (new EducationForm())->find($education_form_id);
@endphp
<p>{{ $educationForm->name }} - {{ $amount }}</p>
@endforeach
<h2>
стоимость обучения
</h2>
@foreach($costs as $education_form_id => $cost)
@php
$educationForm = (new EducationForm())->find($education_form_id);
@endphp
<p>{{ $educationForm->name }} - {{ $cost }}</p>
@endforeach
<h2>Профили подготовки</h2>
@foreach($direction->directionProfiles as $profile)
<p>{{ $profile->name }}</p>
@endforeach
<h2>Профили подготовки</h2>
@foreach($direction->periods as $period)
@php
$educationForm = (new EducationForm())->find($period->education_form_id);
@endphp
<p>{{ $educationForm->name }} - {{ $period->period }}</p>
@endforeach
</div> </div>
@endauth @endauth
@endsection @endsection

View File

@ -34,7 +34,7 @@ Route::middleware(['auth', 'verified'])->prefix('admin')->group(function () {
Route::resource('/educational_institutions', EducationalInstitutionController::class) Route::resource('/educational_institutions', EducationalInstitutionController::class)
->scoped(['educational_institution' => 'slug']); ->scoped(['educational_institution' => 'slug']);
Route::resource('/directions', DirectionController::class) Route::resource('/directions', DirectionController::class)
->scoped(['directions' => 'slug']); ->scoped(['direction' => 'slug']);
Route::resource('/departments', DepartmentController::class) Route::resource('/departments', DepartmentController::class)
->scoped(['department' => 'slug']); ->scoped(['department' => 'slug']);