fix tests errors

This commit is contained in:
aslan 2024-03-05 16:51:29 +03:00
parent 6ae42fafe8
commit 19ea529eb2
5 changed files with 20 additions and 21 deletions

View File

@ -73,6 +73,7 @@ class DirectionController extends Controller
$direction->period = $validated['period']; $direction->period = $validated['period'];
$direction->save(); $direction->save();
if (array_key_exists('entrance-examination', $validated)) {
foreach ($validated['entrance-examination'] as $data) { foreach ($validated['entrance-examination'] as $data) {
$entranceExamination = new EntranceExamination(); $entranceExamination = new EntranceExamination();
$entranceExamination->examination_type_id = $data['examination_type_id']; $entranceExamination->examination_type_id = $data['examination_type_id'];
@ -83,6 +84,8 @@ class DirectionController extends Controller
$entranceExamination->subject_type_id = $data['subject_type_id']; $entranceExamination->subject_type_id = $data['subject_type_id'];
$entranceExamination->save(); $entranceExamination->save();
} }
}
if (array_key_exists('direction_profiles', $validated)) { if (array_key_exists('direction_profiles', $validated)) {

View File

@ -21,14 +21,4 @@ class EducationForm extends Model
{ {
return $this->hasMany('App\Models\Direction', 'education_form_id'); return $this->hasMany('App\Models\Direction', 'education_form_id');
} }
public function places(): HasMany
{
return $this->hasMany('App\Models\Place', 'education_form_id');
}
public function costs(): HasMany
{
return $this->hasMany('App\Models\Cost', 'education_form_id');
}
} }

View File

@ -1,6 +1,7 @@
<?php <?php
use App\Http\Controllers\admin\PageController; use App\Http\Controllers\admin\PageController;
use App\Models\Faculty;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
Route::get('/inostran', function () { Route::get('/inostran', function () {
@ -14,7 +15,8 @@ Route::get('/magistr', function () {
Route::get('/home', [PageController::class, 'directions'])->name('home'); Route::get('/home', [PageController::class, 'directions'])->name('home');
Route::get('/', function () { Route::get('/', function () {
return view('new-design.bakalavr-special'); $faculties = Faculty::all();
return view('new-design.bakalavr-special', compact('faculties'));
})->name('bakalavr-special'); })->name('bakalavr-special');
Route::get('/course', function () { Route::get('/course', function () {

View File

@ -47,6 +47,11 @@ class DirectionTest extends TestCase
'education_level_id', 'education_level_id',
'education_form_id', 'education_form_id',
'department_id', 'department_id',
'budget_places',
'quota',
'paid_places',
'cost_paid_place',
'period'
]); ]);
$this->user = User::factory()->create([ $this->user = User::factory()->create([

View File

@ -36,7 +36,6 @@ class DirectionProfileTest extends TestCase
'position', 'position',
'description', 'description',
'slug', 'slug',
'direction_id',
]); ]);
$this->user = User::factory()->create([ $this->user = User::factory()->create([