diff --git a/app/Http/Controllers/Admin/EducationController.php b/app/Http/Controllers/Admin/EducationController.php index 0840422..21669b7 100644 --- a/app/Http/Controllers/Admin/EducationController.php +++ b/app/Http/Controllers/Admin/EducationController.php @@ -6,6 +6,7 @@ use App\Http\Controllers\Controller; use App\Http\Requests\EducationRequest; use App\Models\Education; use Illuminate\Http\Request; +use Illuminate\Support\Facades\Storage; class EducationController extends Controller { @@ -38,7 +39,13 @@ class EducationController extends Controller */ public function store(EducationRequest $request) { - Education::create($request->all()); + $params = $request->all(); + if ($request->has('image')) { + $params['image'] = $request->file('image')->store("education", 'public'); + } + Education::create($params); + + return redirect()->route('admin.education.index'); } @@ -61,6 +68,7 @@ class EducationController extends Controller */ public function edit(Education $education) { + return view('admin.education.edit', compact('education')); } @@ -73,7 +81,15 @@ class EducationController extends Controller */ public function update(EducationRequest $request, Education $education) { - $education->update($request->all()); + $params = $request->all(); + if ($request->has('image')) { + if (!empty($education->image)) { + Storage::delete($education->image); + } + $params['image'] = $request->file('image')->store("education", 'public'); + } + + $education->update($params); return redirect()->route('admin.education.index'); } diff --git a/app/Http/Requests/EducationRequest.php b/app/Http/Requests/EducationRequest.php index 64d3414..77fff55 100644 --- a/app/Http/Requests/EducationRequest.php +++ b/app/Http/Requests/EducationRequest.php @@ -25,6 +25,11 @@ class EducationRequest extends FormRequest { return [ 'name' => 'required|min:3|max:255', + 'email' => 'required|email|min:5', + 'image' => [ + 'mimes:jpeg,jpg,png', + 'max:10000' + ], ]; } @@ -39,6 +44,7 @@ class EducationRequest extends FormRequest 'string' => 'Поле «:attribute» должно быть не больше :max символов', 'file' => 'Файл «:attribute» должен быть не больше :max Кбайт' ], + 'email' => 'Введите корректный емайл' ]; } diff --git a/app/Models/Education.php b/app/Models/Education.php index cef0e50..b8bc42f 100644 --- a/app/Models/Education.php +++ b/app/Models/Education.php @@ -11,7 +11,12 @@ class Education extends Model protected $fillable = [ 'name', - 'is_remove' + 'is_remove', + 'address', + 'telephone', + 'email', + 'text', + 'image' ]; public function scopeActive($query) { diff --git a/database/migrations/2023_10_10_094144_alter_table_education.php b/database/migrations/2023_10_10_094144_alter_table_education.php new file mode 100644 index 0000000..0f02590 --- /dev/null +++ b/database/migrations/2023_10_10_094144_alter_table_education.php @@ -0,0 +1,40 @@ +string('address', 255)->nullable(); + $table->string('telephone', 255)->nullable(); + $table->string('email', 255)->nullable(); + $table->text('text')->nullable(); + $table->string('image', 255)->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('education', function (Blueprint $table) { + $table->dropColumn('address'); + $table->dropColumn('telephone'); + $table->dropColumn('email'); + $table->dropColumn('text'); + $table->dropColumn('image'); + }); + } +}; diff --git a/html/public/modals.html b/html/public/modals.html index 18372ba..22c6830 100644 --- a/html/public/modals.html +++ b/html/public/modals.html @@ -872,17 +872,43 @@
- + +
+
-

Modal header @@ -954,11 +980,13 @@ > Cancel +

+
diff --git a/resources/views/admin/ad_employers/index.blade.php b/resources/views/admin/ad_employers/index.blade.php index 154bc01..a2158fe 100644 --- a/resources/views/admin/ad_employers/index.blade.php +++ b/resources/views/admin/ad_employers/index.blade.php @@ -87,10 +87,10 @@ {{ $ad->status }} - {{ $ad->created_at }} + {{ date('d.m.Y', strtotime($ad->created_at)) }} - {{ $ad->updated_at }} + {{ date('d.m.Y', strtotime($ad->updated_at)) }} diff --git a/resources/views/admin/education/add.blade.php b/resources/views/admin/education/add.blade.php index 815a736..9c4cb41 100644 --- a/resources/views/admin/education/add.blade.php +++ b/resources/views/admin/education/add.blade.php @@ -1,7 +1,7 @@ @extends('layout.admin', ['title' => 'Админка - Добавление образования']) @section('content') -
+ @include('admin.education.form')
@endsection diff --git a/resources/views/admin/education/edit.blade.php b/resources/views/admin/education/edit.blade.php index cf7800b..c2be717 100644 --- a/resources/views/admin/education/edit.blade.php +++ b/resources/views/admin/education/edit.blade.php @@ -1,7 +1,7 @@ @extends('layout.admin', ['title' => 'Админка - Редактирование образования']) @section('content') -
+ @include('admin.education.form')
@endsection diff --git a/resources/views/admin/education/form.blade.php b/resources/views/admin/education/form.blade.php index d52f581..a9ea05b 100644 --- a/resources/views/admin/education/form.blade.php +++ b/resources/views/admin/education/form.blade.php @@ -6,10 +6,10 @@

+
+ +
+ +
+ +
+ +
+
+ + diff --git a/resources/views/admin/education/index.blade.php b/resources/views/admin/education/index.blade.php index 4caa35b..0303341 100644 --- a/resources/views/admin/education/index.blade.php +++ b/resources/views/admin/education/index.blade.php @@ -24,8 +24,8 @@ > № Название образования - Дата создания Редактировать + Дата создания @@ -37,9 +37,7 @@ {{$cat->name}} - - {{$cat->created_at}} - +
Изменить | @@ -48,6 +46,9 @@
+ + {{ date('d.m.Y', strtotime($cat->created_at))}} + @endforeach diff --git a/resources/views/admin/employer/index.blade.php b/resources/views/admin/employer/index.blade.php index 2b65a7d..fec831d 100644 --- a/resources/views/admin/employer/index.blade.php +++ b/resources/views/admin/employer/index.blade.php @@ -36,12 +36,31 @@ }); + @endsection @section('search') @include('admin.find_employer', ['select_category' => $select_category]) @endsection +@section('modal') + @include('admin.employer.modal') +@endsection + @section('content')
@@ -62,7 +81,9 @@
- +
+        
+    
@@ -110,19 +131,19 @@ {{ $user->category }} - {{ $user->comment_admin }} + @if (!empty($user->comment_admin)) + Есть + @else + Нет + @endif - {{ $user->created_at }} + {{ date('d.m.Y', strtotime($user->created_at)) }} @if (!empty($user->emp_id)) -
Изменить | - @csrf - @method('DELETE') - -
+ Удалить @endif @endforeach diff --git a/resources/views/admin/employer/modal.blade.php b/resources/views/admin/employer/modal.blade.php new file mode 100644 index 0000000..f439552 --- /dev/null +++ b/resources/views/admin/employer/modal.blade.php @@ -0,0 +1,87 @@ + +
+ + +
+ diff --git a/resources/views/admin/message/index.blade.php b/resources/views/admin/message/index.blade.php index 5af7dfb..2dd9c10 100644 --- a/resources/views/admin/message/index.blade.php +++ b/resources/views/admin/message/index.blade.php @@ -90,7 +90,7 @@
- {{ $msg->created_at }} + {{ date('d.m.Y h:i:s', strtotime($msg->created_at)) }} @if (isset($msg->user_to->id)) diff --git a/resources/views/admin/message/index_ajax.blade.php b/resources/views/admin/message/index_ajax.blade.php index b99c8d2..287d163 100644 --- a/resources/views/admin/message/index_ajax.blade.php +++ b/resources/views/admin/message/index_ajax.blade.php @@ -43,7 +43,7 @@
- {{ $msg->created_at }} + {{ date('d.m.Y h:i:s', strtotime($msg->created_at)) }} @if (isset($msg->user_to->id)) diff --git a/resources/views/admin/users/index.blade.php b/resources/views/admin/users/index.blade.php index a52ddc1..49cd5ac 100644 --- a/resources/views/admin/users/index.blade.php +++ b/resources/views/admin/users/index.blade.php @@ -126,7 +126,7 @@ @endif - {{ $user->created_at }} + {{ date('d.m.Y', strtotime($user->created_at)) }} @endforeach diff --git a/resources/views/admin/users/index_ajax.blade.php b/resources/views/admin/users/index_ajax.blade.php index a9031f1..966518b 100644 --- a/resources/views/admin/users/index_ajax.blade.php +++ b/resources/views/admin/users/index_ajax.blade.php @@ -60,7 +60,7 @@ @endif - {{ $user->created_at }} + {{ date('d.m.Y', strtotime($user->created_at)) }} @endforeach diff --git a/resources/views/admin/worker/index.blade.php b/resources/views/admin/worker/index.blade.php index 4c74851..2a0d423 100644 --- a/resources/views/admin/worker/index.blade.php +++ b/resources/views/admin/worker/index.blade.php @@ -108,7 +108,7 @@ @endif - {{ $user->created_at }} + {{ date('d.m.Y h:i:s', strtotime($user->created_at)) }} diff --git a/resources/views/admin/worker/index_ajax.blade.php b/resources/views/admin/worker/index_ajax.blade.php index b000ff5..c5c1c8e 100644 --- a/resources/views/admin/worker/index_ajax.blade.php +++ b/resources/views/admin/worker/index_ajax.blade.php @@ -58,7 +58,7 @@ @endif - {{ $user->created_at }} + {{ date('d.m.Y h:i:s', strtotime($user->created_at)) }} @if ($user->id > 1) @@ -68,11 +68,11 @@ @endif @endif - + @endforeach diff --git a/resources/views/layout/admin.blade.php b/resources/views/layout/admin.blade.php index 554b639..7b64f16 100644 --- a/resources/views/layout/admin.blade.php +++ b/resources/views/layout/admin.blade.php @@ -88,6 +88,27 @@ @endif
  • + + + Администраторы + +
  • +
  • @@ -110,7 +131,7 @@
  • @endif
  • + + + Администраторы + +
  • + +
  • @@ -1746,6 +1789,7 @@ +@yield('modal') @yield('script') diff --git a/routes/web.php b/routes/web.php index f83d12e..00c30ef 100644 --- a/routes/web.php +++ b/routes/web.php @@ -161,7 +161,7 @@ Route::group([ // кабинет профиль работодатель - сохранение формы Route::post('employer-profile/{employer}', [EmployersController::class, 'update_employer'])->name('update-employer-profile'); // кабинет удаление профиль работодателя и юзера - Route::delete('employer-profile/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer'); + Route::delete('employers/delete/{employer}/{user}', [EmployersController::class, 'delete_employer'])->name('delete-employer'); // кабинет профиль работник - форма Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit');