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') }}