Commit 95378625599f82b83f8ac938a29edb6333720874

Authored by Hayk Nazaryan
1 parent 298bab702d
Exists in master

verify workers from admin panel

Showing 3 changed files with 17 additions and 1 deletions Side-by-side Diff

app/Http/Controllers/Admin/WorkersController.php
... ... @@ -105,6 +105,14 @@ class WorkersController extends Controller
105 105 return view('admin.worker.edit', compact('worker', 'job_titles', 'time_end_anketa'));
106 106 }
107 107  
  108 + public function verify_worker(User $user) {
  109 + if ($user->id) {
  110 + $user->update(['email_verified_at' => now()]);
  111 + }
  112 +
  113 + return redirect()->back();
  114 + }
  115 +
108 116 public function form_update_worker(Request $request, Worker $worker)
109 117 {
110 118 $params = $request->all();
resources/views/admin/worker/index.blade.php
... ... @@ -77,6 +77,7 @@
77 77 <th class="px-4 py-3">% анкеты</th>
78 78 <th class="px-4 py-3">Должность</th>
79 79 <th class="px-4 py-3">Дата регистрации</th>
  80 + <th class="px-4 py-3">Дата подтверждения</th>
80 81 <th class="px-4 py-3">Изменить</th>
81 82 </tr>
82 83 </thead>
... ... @@ -162,9 +163,15 @@
162 163 {{ date('d.m.Y h:i:s', strtotime($user->created_at)) }}
163 164 </td>
164 165 <td class="px-4 py-3 text-xs">
  166 + @if($user->email_verified_at)
  167 + {{ date('d.m.Y h:i:s', strtotime($user->email_verified_at)) }}
  168 + @else
  169 + <a href="{{ route('admin.worker-verify', ['user' => $user->id]) }}" class="text-green-500">Подтвердить</a>
  170 + @endif
  171 + </td>
  172 + <td class="px-4 py-3 text-xs">
165 173 @if (isset($user->workers[0]->id))
166 174 <a href="{{ route('admin.worker-profile-edit', ['worker' => $user->workers[0]->id]) }}">Изменить</a>
167   -
168 175 @endif
169 176 </td>
170 177 </tr>
... ... @@ -125,6 +125,7 @@ Route::group([
125 125 Route::get('worker-profile/add/{user}', [WorkersController::class, 'form_add_worker'])->name('worker-profile-add');
126 126 Route::post('worker-profile/add/{user}', [WorkersController::class, 'form_store_worker'])->name('worker-profile-store');
127 127 Route::get('worker-profile/{worker}', [WorkersController::class, 'form_edit_worker'])->name('worker-profile-edit');
  128 + Route::get('worker-verify/{user}', [WorkersController::class, 'verify_worker'])->name('worker-verify');
128 129 // кабинет профиль работник - сохранение формы
129 130 Route::post('worker-profile/{worker}', [WorkersController::class, 'form_update_worker'])->name('worker-profile-update');
130 131