From 95378625599f82b83f8ac938a29edb6333720874 Mon Sep 17 00:00:00 2001 From: anazaryan Date: Mon, 16 Dec 2024 20:51:03 +0400 Subject: [PATCH] verify workers from admin panel --- app/Http/Controllers/Admin/WorkersController.php | 8 ++++++++ resources/views/admin/worker/index.blade.php | 9 ++++++++- routes/web.php | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Admin/WorkersController.php b/app/Http/Controllers/Admin/WorkersController.php index 7e1f324..b7906d4 100644 --- a/app/Http/Controllers/Admin/WorkersController.php +++ b/app/Http/Controllers/Admin/WorkersController.php @@ -105,6 +105,14 @@ class WorkersController extends Controller return view('admin.worker.edit', compact('worker', 'job_titles', 'time_end_anketa')); } + public function verify_worker(User $user) { + if ($user->id) { + $user->update(['email_verified_at' => now()]); + } + + return redirect()->back(); + } + public function form_update_worker(Request $request, Worker $worker) { $params = $request->all(); diff --git a/resources/views/admin/worker/index.blade.php b/resources/views/admin/worker/index.blade.php index a672584..99c4c4e 100644 --- a/resources/views/admin/worker/index.blade.php +++ b/resources/views/admin/worker/index.blade.php @@ -77,6 +77,7 @@ % анкеты Должность Дата регистрации + Дата подтверждения Изменить @@ -162,9 +163,15 @@ {{ date('d.m.Y h:i:s', strtotime($user->created_at)) }} + @if($user->email_verified_at) + {{ date('d.m.Y h:i:s', strtotime($user->email_verified_at)) }} + @else + Подтвердить + @endif + + @if (isset($user->workers[0]->id)) Изменить - @endif diff --git a/routes/web.php b/routes/web.php index fe40182..5e97f6c 100644 --- a/routes/web.php +++ b/routes/web.php @@ -125,6 +125,7 @@ Route::group([ Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add'); Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store'); Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit'); + Route::get('worker-verify/{user}', [WorkersController::class, 'verify_worker'])->name('worker-verify'); // кабинет профиль работник - сохранение формы Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update'); -- 1.7.10.4