From fce775cb9acd968dba45d01fc346e2551c44dd6a 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: Thu, 23 Nov 2023 13:42:54 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B0=D0=B7=D0=B4=D0=B5=D0=BB=20=D0=B2=20=D1?= =?UTF-8?q?=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D0=B5=20=D0=9F=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D0=B8,=20=D0=B4=D0=BE=D0?= =?UTF-8?q?=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=80=D0=BE=D0=BB?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=B0=D0=B4=D0=BC=D0=B8=D0=BD=D1=83=20=D0=B8=20=D0?= =?UTF-8?q?=BC=D0=B5=D0=BD=D0=B5=D0=B4=D0=B6=D0=B5=D1=80=D0=B0=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Admin/UsersController.php | 2 ++ app/Models/User.php | 2 ++ resources/views/admin/users/index.blade.php | 27 ++++++++++++---------- resources/views/admin/users/index_ajax.blade.php | 26 +++++++++++---------- 4 files changed, 33 insertions(+), 24 deletions(-) diff --git a/app/Http/Controllers/Admin/UsersController.php b/app/Http/Controllers/Admin/UsersController.php index 12df4d6..7061ba2 100644 --- a/app/Http/Controllers/Admin/UsersController.php +++ b/app/Http/Controllers/Admin/UsersController.php @@ -27,6 +27,7 @@ class UsersController extends Controller $request->offsetUnset('id'); $user->update($request->all()); } + $find_key = ""; $users = User::query(); if (isset($request->find)) { @@ -34,6 +35,7 @@ class UsersController extends Controller $users = $users->where('name', 'LIKE', "%$find_key%") ->orWhere('email', 'LIKE', "%$find_key%"); } + $users = $users->paginate(15); if ($request->ajax()) { diff --git a/app/Models/User.php b/app/Models/User.php index 40da22e..eaf598f 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -17,6 +17,7 @@ class User extends Authenticatable * * @var array */ + protected $fillable = [ 'name', 'email', @@ -40,6 +41,7 @@ class User extends Authenticatable 'birthday', 'file', 'pubpassword', + 'is_manager', ]; /** diff --git a/resources/views/admin/users/index.blade.php b/resources/views/admin/users/index.blade.php index 8ebf994..1cd6621 100644 --- a/resources/views/admin/users/index.blade.php +++ b/resources/views/admin/users/index.blade.php @@ -7,6 +7,7 @@ var this_ = $(this); var value = this_.val(); var field = this_.attr('data-field'); + var value_id = this_.attr('data-id'); var ajax_block = $('#ajax_block'); var bool = 0; var str_get = ''; @@ -17,7 +18,7 @@ bool = 0; } console.log(field); - str_get = "id=" + value + "&" + field + "=" + bool; + str_get = "id=" + value_id + "&" + field + "=" + bool; console.log(str_get); $.ajax({ @@ -58,9 +59,8 @@ Имя Email/логин Работодатель/работник/администратор - @if ($id_admin == 1) Админ - @endif + Менеджер Дата регист. @@ -96,13 +96,17 @@ @endif - @if ($id_admin == 1) - - @if ($user->id > 1) - admin) ? "checked" : "" }}/> - @endif - - @endif + + @if ($user->id > 1) + admin) ? "checked" : "" }}/> + @endif + + + + @if ($user->id > 1) + is_manager) ? "checked" : "" }}/> + @endif + {{ date('d.m.Y', strtotime($user->created_at)) }} @@ -114,8 +118,7 @@
- appends($_GET)->links('admin.pagginate'); ?> - links('admin.pagginate'); ?> + {{ $users->links('admin.pagginate') }}
diff --git a/resources/views/admin/users/index_ajax.blade.php b/resources/views/admin/users/index_ajax.blade.php index 9ae32df..1835597 100644 --- a/resources/views/admin/users/index_ajax.blade.php +++ b/resources/views/admin/users/index_ajax.blade.php @@ -8,9 +8,8 @@ Имя Email/логин Работодатель/работник/администратор - @if ($id_admin == 1) - Админ - @endif + Админ + Менеджер Дата регист. @@ -46,13 +45,17 @@ @endif - @if ($id_admin == 1) - - @if ($user->id > 1) - admin) ? "checked" : "" }}/> - @endif - - @endif + + @if ($user->id > 1) + admin) ? "checked" : "" }}/> + @endif + + + + @if ($user->id > 1) + is_manager) ? "checked" : "" }}/> + @endif + {{ date('d.m.Y', strtotime($user->created_at)) }} @@ -64,6 +67,5 @@
- appends($_GET)->links('admin.pagginate'); ?> - links('admin.pagginate'); ?> + {{ $users->links('admin.pagginate') }}
-- 1.7.10.4