|
|
@@ -22,7 +22,8 @@ class UserController extends Controller
|
|
|
'name' => 'ФИО',
|
|
|
'phone' => 'Телефон',
|
|
|
'role' => 'Роль',
|
|
|
- 'created_at' => 'Дата создания'
|
|
|
+ 'created_at' => 'Дата создания',
|
|
|
+ 'deleted_at' => 'Дата Удаления',
|
|
|
],
|
|
|
'searchFields' => [
|
|
|
'name',
|
|
|
@@ -47,7 +48,7 @@ class UserController extends Controller
|
|
|
$this->acceptFilters($q, $request);
|
|
|
$this->acceptSearch($q, $request);
|
|
|
$this->setSortAndOrderBy($model, $request);
|
|
|
-
|
|
|
+ $q->withTrashed();
|
|
|
$q->orderBy($this->data['sortBy'], $this->data['orderBy']);
|
|
|
$this->data['users'] = $q->paginate(session('per_page', config('pagination.per_page')))->withQueryString();
|
|
|
|
|
|
@@ -89,9 +90,12 @@ class UserController extends Controller
|
|
|
/**
|
|
|
* Display the specified resource.
|
|
|
*/
|
|
|
- public function show(User $user)
|
|
|
+ public function show(int $userId)
|
|
|
{
|
|
|
- $this->data['user'] = $user;
|
|
|
+ $this->data['user'] = User::query()
|
|
|
+ ->where('id', $userId)
|
|
|
+ ->withTrashed()
|
|
|
+ ->first();
|
|
|
return view('users.edit', $this->data);
|
|
|
}
|
|
|
|
|
|
@@ -140,5 +144,11 @@ class UserController extends Controller
|
|
|
return redirect()->route('login')->with(['success' => 'Профиль удалён!']);
|
|
|
}
|
|
|
|
|
|
+ public function undelete(int $userId)
|
|
|
+ {
|
|
|
+ User::query()->where('id', '=', $userId)->restore();
|
|
|
+ return redirect()->route('user.show', $userId)->with(['success' => 'Пользователь восстановлен!']);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|