diff --git a/app/Http/Controllers/Admin/UsersController.php b/app/Http/Controllers/Admin/UsersController.php
index 4f2a512..12df4d6 100644
--- a/app/Http/Controllers/Admin/UsersController.php
+++ b/app/Http/Controllers/Admin/UsersController.php
@@ -150,11 +150,11 @@ class UsersController extends Controller
public function admin_roles(Request $request) {
if ($request->ajax()) {
- $content_roles = ContentRoles::find($request->id);
- $request->offsetUnset($request->id);
- $content_roles->update($request->all());
+ $id = $request->id;
+ $request->offsetUnset('id');
+ ContentRoles::where('id', '=', $id)->update($request->all());
}
- $roles = ContentRoles::query()->OrderBy('name')->paginate(25);
+ $roles = ContentRoles::query()->OrderBy('id')->paginate(25);
if ($request->ajax()) {
diff --git a/resources/views/admin/content/roles_index.blade.php b/resources/views/admin/content/roles_index.blade.php
index 63ef07f..52ddf74 100644
--- a/resources/views/admin/content/roles_index.blade.php
+++ b/resources/views/admin/content/roles_index.blade.php
@@ -5,7 +5,7 @@
$(document).ready(function() {
$(document).on('click', '.check_click', function () {
var this_ = $(this);
- var value = this_.val();
+ var value_id = this_.attr('data-id');
var field = this_.attr('data-field');
var ajax_block = $('#ajax_block');
var bool = 0;
@@ -16,8 +16,9 @@
} else {
bool = 0;
}
+
console.log(field);
- str_get = "id=" + value + "&" + field + "=" + bool;
+ str_get = "id=" + value_id + "&" + field + "=" + bool;
console.log(str_get);
$.ajax({
@@ -25,7 +26,7 @@
url: "{{ url()->full()}}",
data: str_get,
success: function (data) {
- console.log('Обновление таблицы пользователей ');
+ console.log('Обновление таблицы ролей ');
//data = JSON.parse(data);
//console.log(data);
ajax_block.html(data);
@@ -71,10 +72,12 @@
{{ $role->url_page }}
- {{ $role->is_admin }}
+ is_admin) ? "checked" : "" }}/>
+
|
- {{ $role->is_manager }}
+ is_manager) ? "checked" : "" }}/>
+
|
diff --git a/resources/views/admin/content/roles_index_ajax.blade.php b/resources/views/admin/content/roles_index_ajax.blade.php
index e69de29..a0f495f 100644
--- a/resources/views/admin/content/roles_index_ajax.blade.php
+++ b/resources/views/admin/content/roles_index_ajax.blade.php
@@ -0,0 +1,47 @@
+
+
+
+ {{$roles->links('admin.pagginate') }}
+
diff --git a/resources/views/layout/admin.blade.php b/resources/views/layout/admin.blade.php
index f24e8c0..e3bd5f2 100644
--- a/resources/views/layout/admin.blade.php
+++ b/resources/views/layout/admin.blade.php
@@ -32,9 +32,7 @@
href="{{ route('admin.index') }}">
Админка
-
- @if (($is_manager == 1) || ($admin == 1))
-
Главная страница
- @endif
+
- @endif
-
- @if ($admin)
- @endif
-
+
@@ -1071,25 +1279,62 @@
class="p-2 mt-2 space-y-2 overflow-hidden text-sm font-medium text-gray-500 rounded-md shadow-inner bg-gray-50 dark:text-gray-400 dark:bg-gray-900"
aria-label="submenu"
>
-
- Редактор сайта
-
-
- Шапка-футер сайта
-
-
- SEO сайта
-
-
- Редактор страниц
-
-
- Должности на главной
-
-
- Работодатели на главной
-
+ @foreach ($contents as $cont)
+ @if ($cont->url_page == "admin/editor-site")
+ @if ((($cont->is_admin == 1) && ($admin == 1)) ||
+ (($cont->is_manager == 1) && ($is_manager == 1)))
+
+ Редактор сайта
+
+ @endif
+ @endif
+
+ @if ($cont->url_page == "admin/edit-blocks")
+ @if ((($cont->is_admin == 1) && ($admin == 1)) ||
+ (($cont->is_manager == 1) && ($is_manager == 1)))
+
+ Шапка-футер сайта
+
+ @endif
+ @endif
+
+ @if ($cont->url_page == "admin/editor-seo")
+ @if ((($cont->is_admin == 1) && ($admin == 1)) ||
+ (($cont->is_manager == 1) && ($is_manager == 1)))
+
+ SEO сайта
+
+ @endif
+ @endif
+
+ @if ($cont->url_page == "admin/editor-pages")
+ @if ((($cont->is_admin == 1) && ($admin == 1)) ||
+ (($cont->is_manager == 1) && ($is_manager == 1)))
+
+ Редактор страниц
+
+ @endif
+ @endif
+
+ @if ($cont->url_page == "admin/job-titles-main")
+ @if ((($cont->is_admin == 1) && ($admin == 1)) ||
+ (($cont->is_manager == 1) && ($is_manager == 1)))
+
+ Должности на главной
+
+ @endif
+ @endif
+
+ @if ($cont->url_page == "admin/employers-main")
+ @if ((($cont->is_admin == 1) && ($admin == 1)) ||
+ (($cont->is_manager == 1) && ($is_manager == 1)))
+
+ Работодатели на главной
+
+ @endif
+ @endif
+ @endforeach
|