From 46be695f582eddf57b3be55715f7272835f1d84b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=20=D0=9B=D0=B0=D1=80?= =?UTF-8?q?=D0=B8=D0=BE=D0=BD=D0=BE=D0=B2?= Date: Wed, 1 Nov 2023 15:12:54 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D1=80=D0=B0=D0=B7=D0=BE=D0=B2=D0=B0=D0?= =?UTF-8?q?=BD=D0=B8=D0=B5=20=D0=B8=20=D1=81=D0=BF=D0=B5=D1=86=D0=B8=D0=B0=D0?= =?UTF-8?q?=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20=D0=B2=20=D1=83=D1=87=D0?= =?UTF-8?q?=B5=D0=B1=D0=BD=D1=8B=D1=85=20=D0=B7=D0=B0=D0=B2=D0=B5=D0=B4=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Admin/EducationController.php | 16 ++- resources/views/admin/education/add.blade.php | 2 +- resources/views/admin/education/form-add.blade.php | 108 ++++++++++++++++++++ resources/views/admin/education/form.blade.php | 1 + resources/views/admin/education/index.blade.php | 2 +- routes/web.php | 1 + 6 files changed, 119 insertions(+), 11 deletions(-) create mode 100644 resources/views/admin/education/form-add.blade.php diff --git a/app/Http/Controllers/Admin/EducationController.php b/app/Http/Controllers/Admin/EducationController.php index c34bd73..06d1243 100644 --- a/app/Http/Controllers/Admin/EducationController.php +++ b/app/Http/Controllers/Admin/EducationController.php @@ -70,17 +70,8 @@ class EducationController extends Controller */ public function edit(Education $education) { - /*$program1 = ProgramEducation::query()->where('education_id', '=', $education->id) - ->where('level', '=', '1')->get(); - $program2 = ProgramEducation::query()->where('education_id', '=', $education->id) - ->where('level', '=', '2')->get(); - $program3 = ProgramEducation::query()->where('education_id', '=', $education->id) - ->where('level', '=', '3')->get(); - */ - $program = ProgramEducation::query()->where('education_id', '=', $education->id) ->orderBy('level')->get(); - return view('admin.education.edit', compact('education', 'program')); } @@ -130,4 +121,11 @@ class EducationController extends Controller return redirect()->route('admin.education.edit', ['education' => $education]); } + public function delete_program(ProgramEducation $program, Education $education) { + $education = $education->id; + $program->delete(); + + return redirect()->route('admin.education.edit', ['education' => $education]); + } + } diff --git a/resources/views/admin/education/add.blade.php b/resources/views/admin/education/add.blade.php index 9c4cb41..14e5617 100644 --- a/resources/views/admin/education/add.blade.php +++ b/resources/views/admin/education/add.blade.php @@ -2,6 +2,6 @@ @section('content')
- @include('admin.education.form') + @include('admin.education.form-add')
@endsection diff --git a/resources/views/admin/education/form-add.blade.php b/resources/views/admin/education/form-add.blade.php new file mode 100644 index 0000000..2a7b610 --- /dev/null +++ b/resources/views/admin/education/form-add.blade.php @@ -0,0 +1,108 @@ +@csrf + +@isset($education) + @method('PUT') +@endisset + +
+
+ +
+ +
+ +
+ +
+ +
+ +
+
+ + Назад +
+
+
+ + + + diff --git a/resources/views/admin/education/form.blade.php b/resources/views/admin/education/form.blade.php index b36b210..65bf479 100644 --- a/resources/views/admin/education/form.blade.php +++ b/resources/views/admin/education/form.blade.php @@ -139,6 +139,7 @@

@endforeach diff --git a/resources/views/admin/education/index.blade.php b/resources/views/admin/education/index.blade.php index 1535ce2..876db53 100644 --- a/resources/views/admin/education/index.blade.php +++ b/resources/views/admin/education/index.blade.php @@ -35,7 +35,7 @@ {{$cat->id}} - {{ $cat->name }} + {{ mb_strimwidth($cat->name, 0, 50, "...") }} diff --git a/routes/web.php b/routes/web.php index ea158a1..b901f71 100644 --- a/routes/web.php +++ b/routes/web.php @@ -228,6 +228,7 @@ Route::group([ Route::get('program-education', [EducationController::class, 'add_program'])->name('add-program-education'); Route::post('program-education', [EducationController::class, 'store_program'])->name('store-program-education'); + Route::get('program-education/delete/{program}/{education}', [EducationController::class, 'delete_program'])->name('delete-program-education'); //Route::get('job-titles', [AdminController::class, 'index'])->name('job-titles'); /* -- 1.7.10.4