Commit 80e6ce32abdb9d0b9a3eddd22b7c9203912d6ab2
Exists in
master
Merge branch 'master' of http://gitlab.nologostudio.ru/alarionov/rekamore-su
Showing 14 changed files Side-by-side Diff
- app/Http/Controllers/Admin/EmployersController.php
- app/Http/Controllers/Admin/UsersController.php
- app/Models/ContentRoles.php
- app/Providers/MyServiceProvider.php
- database/migrations/2023_11_20_062736_alter_users_table.php
- database/migrations/2023_11_20_064430_create_content_roles_table.php
- database/migrations/2023_11_20_070121_alter_content_roles_table.php
- resources/views/admin/content/roles_index.blade.php
- resources/views/admin/content/roles_index_ajax.blade.php
- resources/views/admin/employer/index.blade.php
- resources/views/admin/users/index.blade.php
- resources/views/admin/users/index_ajax.blade.php
- resources/views/layout/admin.blade.php
- routes/web.php
app/Http/Controllers/Admin/EmployersController.php
... | ... | @@ -59,6 +59,7 @@ class EmployersController extends Controller |
59 | 59 | } |
60 | 60 | |
61 | 61 | //DB::enableQueryLog(); |
62 | + $all_current = $users->count(); | |
62 | 63 | $users = $users->paginate(15); |
63 | 64 | //dd(DB::getQueryLog()); |
64 | 65 | |
... | ... | @@ -73,6 +74,7 @@ class EmployersController extends Controller |
73 | 74 | 'all_employer', |
74 | 75 | 'all_public', |
75 | 76 | 'all_status', |
77 | + 'all_current', | |
76 | 78 | 'select_category')); |
77 | 79 | } |
78 | 80 | } |
app/Http/Controllers/Admin/UsersController.php
... | ... | @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Admin; |
4 | 4 | |
5 | 5 | use App\Http\Controllers\Controller; |
6 | 6 | use App\Http\Requests\BaseUserRequest; |
7 | +use App\Models\ContentRoles; | |
7 | 8 | use App\Models\Job_title; |
8 | 9 | use App\Models\User; |
9 | 10 | use App\Models\Worker; |
... | ... | @@ -146,6 +147,23 @@ class UsersController extends Controller |
146 | 147 | } |
147 | 148 | } |
148 | 149 | |
150 | + public function admin_roles(Request $request) { | |
151 | + | |
152 | + if ($request->ajax()) { | |
153 | + $content_roles = ContentRoles::find($request->id); | |
154 | + $request->offsetUnset($request->id); | |
155 | + $content_roles->update($request->all()); | |
156 | + } | |
157 | + $roles = ContentRoles::query()->OrderBy('name')->paginate(25); | |
158 | + | |
159 | + | |
160 | + if ($request->ajax()) { | |
161 | + return view('admin.content.roles_index_ajax', compact('roles')); | |
162 | + } else { | |
163 | + return view('admin.content.roles_index', compact('roles')); | |
164 | + } | |
165 | + } | |
166 | + | |
149 | 167 | public function doc_bd(User $user) { |
150 | 168 | $id = $user->id; |
151 | 169 | $spreadsheet = new Spreadsheet(); |
app/Models/ContentRoles.php
app/Providers/MyServiceProvider.php
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | |
3 | 3 | namespace App\Providers; |
4 | 4 | |
5 | +use App\Models\ContentRoles; | |
5 | 6 | use App\Models\Job_title; |
6 | 7 | use Illuminate\Support\Facades\Auth; |
7 | 8 | use Illuminate\Support\Facades\DB; |
... | ... | @@ -53,13 +54,22 @@ class MyServiceProvider extends ServiceProvider |
53 | 54 | View::composer($views2, |
54 | 55 | function($view){ |
55 | 56 | $id = Auth::user()->id; |
57 | + $is_manager = Auth::user()->is_manager; | |
58 | + $admin = Auth::user()->admin; | |
59 | + | |
60 | + $contents = ContentRoles::query()->get(); | |
61 | + | |
56 | 62 | $query = DB::select(DB::raw('SELECT count(*) as MsgCount |
57 | 63 | FROM messages m1 |
58 | 64 | Where ((m1.flag_new = 1) and (m1.to_user_id = :uid)) |
59 | 65 | '), ['uid' => $id] |
60 | 66 | ); |
61 | 67 | |
62 | - $view->with(['MsgCount' => $query[0]->MsgCount, 'UserId' => $id]); | |
68 | + $view->with(['MsgCount' => $query[0]->MsgCount, | |
69 | + 'UserId' => $id, | |
70 | + 'is_manager' => $is_manager, | |
71 | + 'admin' => $admin, | |
72 | + 'contents' => $contents]); | |
63 | 73 | } |
64 | 74 | ); |
65 | 75 | } |
database/migrations/2023_11_20_062736_alter_users_table.php
... | ... | @@ -0,0 +1,32 @@ |
1 | +<?php | |
2 | + | |
3 | +use Illuminate\Database\Migrations\Migration; | |
4 | +use Illuminate\Database\Schema\Blueprint; | |
5 | +use Illuminate\Support\Facades\Schema; | |
6 | + | |
7 | +return new class extends Migration | |
8 | +{ | |
9 | + /** | |
10 | + * Run the migrations. | |
11 | + * | |
12 | + * @return void | |
13 | + */ | |
14 | + public function up() | |
15 | + { | |
16 | + Schema::table('users', function (Blueprint $table) { | |
17 | + $table->boolean('is_manager')->default(1); | |
18 | + }); | |
19 | + } | |
20 | + | |
21 | + /** | |
22 | + * Reverse the migrations. | |
23 | + * | |
24 | + * @return void | |
25 | + */ | |
26 | + public function down() | |
27 | + { | |
28 | + Schema::table('users', function (Blueprint $table) { | |
29 | + $table->dropColumn('is_manager'); | |
30 | + }); | |
31 | + } | |
32 | +}; |
database/migrations/2023_11_20_064430_create_content_roles_table.php
... | ... | @@ -0,0 +1,34 @@ |
1 | +<?php | |
2 | + | |
3 | +use Illuminate\Database\Migrations\Migration; | |
4 | +use Illuminate\Database\Schema\Blueprint; | |
5 | +use Illuminate\Support\Facades\Schema; | |
6 | + | |
7 | +return new class extends Migration | |
8 | +{ | |
9 | + /** | |
10 | + * Run the migrations. | |
11 | + * | |
12 | + * @return void | |
13 | + */ | |
14 | + public function up() | |
15 | + { | |
16 | + Schema::create('content_roles', function (Blueprint $table) { | |
17 | + $table->id(); | |
18 | + $table->string('url_page', 255); | |
19 | + $table->boolean('is_admin')->default(1); | |
20 | + $table->boolean('is_manager')->default(0); | |
21 | + $table->timestamps(); | |
22 | + }); | |
23 | + } | |
24 | + | |
25 | + /** | |
26 | + * Reverse the migrations. | |
27 | + * | |
28 | + * @return void | |
29 | + */ | |
30 | + public function down() | |
31 | + { | |
32 | + Schema::dropIfExists('content_roles'); | |
33 | + } | |
34 | +}; |
database/migrations/2023_11_20_070121_alter_content_roles_table.php
... | ... | @@ -0,0 +1,32 @@ |
1 | +<?php | |
2 | + | |
3 | +use Illuminate\Database\Migrations\Migration; | |
4 | +use Illuminate\Database\Schema\Blueprint; | |
5 | +use Illuminate\Support\Facades\Schema; | |
6 | + | |
7 | +return new class extends Migration | |
8 | +{ | |
9 | + /** | |
10 | + * Run the migrations. | |
11 | + * | |
12 | + * @return void | |
13 | + */ | |
14 | + public function up() | |
15 | + { | |
16 | + Schema::table('content_roles', function (Blueprint $table) { | |
17 | + $table->string('name', 255)->nullable(false); | |
18 | + }); | |
19 | + } | |
20 | + | |
21 | + /** | |
22 | + * Reverse the migrations. | |
23 | + * | |
24 | + * @return void | |
25 | + */ | |
26 | + public function down() | |
27 | + { | |
28 | + Schema::table('content_roles', function (Blueprint $table) { | |
29 | + $table->dropColumn('name'); | |
30 | + }); | |
31 | + } | |
32 | +}; |
resources/views/admin/content/roles_index.blade.php
... | ... | @@ -0,0 +1,95 @@ |
1 | +@extends('layout.admin', ['title' => 'Роли администраторов и менеджеров для каждой страницы']) | |
2 | + | |
3 | +@section('script') | |
4 | + <script> | |
5 | + $(document).ready(function() { | |
6 | + $(document).on('click', '.check_click', function () { | |
7 | + var this_ = $(this); | |
8 | + var value = this_.val(); | |
9 | + var field = this_.attr('data-field'); | |
10 | + var ajax_block = $('#ajax_block'); | |
11 | + var bool = 0; | |
12 | + var str_get = ''; | |
13 | + | |
14 | + if(this.checked){ | |
15 | + bool = 1; | |
16 | + } else { | |
17 | + bool = 0; | |
18 | + } | |
19 | + console.log(field); | |
20 | + str_get = "id=" + value + "&" + field + "=" + bool; | |
21 | + console.log(str_get); | |
22 | + | |
23 | + $.ajax({ | |
24 | + type: "GET", | |
25 | + url: "{{ url()->full()}}", | |
26 | + data: str_get, | |
27 | + success: function (data) { | |
28 | + console.log('Обновление таблицы пользователей '); | |
29 | + //data = JSON.parse(data); | |
30 | + //console.log(data); | |
31 | + ajax_block.html(data); | |
32 | + }, | |
33 | + headers: { | |
34 | + 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') | |
35 | + }, | |
36 | + error: function (data) { | |
37 | + console.log('Error: ' + data); | |
38 | + } | |
39 | + }); | |
40 | + }); | |
41 | + }); | |
42 | + </script> | |
43 | +@endsection | |
44 | + | |
45 | +@section('content') | |
46 | + <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> | |
47 | + <div class="w-full overflow-x-auto"> | |
48 | + <table class="w-full whitespace-no-wrap"> | |
49 | + <thead> | |
50 | + <tr | |
51 | + class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800" | |
52 | + > | |
53 | + <th class="px-4 py-3 text-xs">№</th> | |
54 | + <th class="px-4 py-3 text-xs">Раздел</th> | |
55 | + <th class="px-4 py-3 text-xs">URL-страницы</th> | |
56 | + <th class="px-4 py-3 text-xs">Админ</th> | |
57 | + <th class="px-4 py-3 text-xs">Менеджер</th> | |
58 | + <th class="px-4 py-3 text-xs">Дата регист.</th> | |
59 | + </tr> | |
60 | + </thead> | |
61 | + <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> | |
62 | + @foreach($roles as $role) | |
63 | + <tr class="text-gray-700 dark:text-gray-400"> | |
64 | + <td class="px-4 py-3 text-xs"> | |
65 | + {{$role->id}} | |
66 | + </td> | |
67 | + <td class="px-4 py-3 text-xs"> | |
68 | + {{$role->name}} | |
69 | + </td> | |
70 | + <td class="px-4 py-3 text-xs"> | |
71 | + {{ $role->url_page }} | |
72 | + </td> | |
73 | + <td class="px-4 py-3 text-xs"> | |
74 | + {{ $role->is_admin }} | |
75 | + </td> | |
76 | + <td class="px-4 py-3 text-xs"> | |
77 | + {{ $role->is_manager }} | |
78 | + </td> | |
79 | + | |
80 | + <td class="px-4 py-3 text-xs"> | |
81 | + {{ date('d.m.Y', strtotime($role->created_at)) }} | |
82 | + </td> | |
83 | + </tr> | |
84 | + @endforeach | |
85 | + </tbody> | |
86 | + </table> | |
87 | + </div> | |
88 | + | |
89 | + <div class="grid px-4 py-3 text-xs font-semibold tracking-wide text-gray-500 uppercase border-t dark:border-gray-700 bg-gray-50 sm:grid-cols-9 dark:text-gray-400 dark:bg-gray-800"> | |
90 | + <?//=$users->appends($_GET)->links('admin.pagginate'); ?> | |
91 | + {{$roles->links('admin.pagginate') }} | |
92 | + </div> | |
93 | + </div> | |
94 | + | |
95 | +@endsection |
resources/views/admin/content/roles_index_ajax.blade.php
resources/views/admin/employer/index.blade.php
... | ... | @@ -116,6 +116,10 @@ |
116 | 116 | </div> |
117 | 117 | </div> |
118 | 118 | |
119 | + <div class="text-gray-700 dark:text-gray-400"> | |
120 | + <p class="px-4 py-3">Количество: {{ $all_current }}</p> | |
121 | + </div> | |
122 | + | |
119 | 123 | <div class="w-full overflow-hidden rounded-lg shadow-xs" id="ajax_block"> |
120 | 124 | <div class="w-full overflow-x-auto"> |
121 | 125 | <table class="w-full whitespace-no-wrap"> |
resources/views/admin/users/index.blade.php
... | ... | @@ -54,43 +54,26 @@ |
54 | 54 | <tr |
55 | 55 | class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800" |
56 | 56 | > |
57 | - <th class="px-4 py-3">№</th> | |
58 | - <th class="px-4 py-3">Имя</th> | |
59 | - <th class="px-4 py-3">Email/логин</th> | |
60 | - <th class="px-4 py-3">Работодатель/работник/администратор</th> | |
61 | - <th class="px-4 py-3">Бан</th> | |
62 | - <th class="px-4 py-3">Новый</th> | |
57 | + <th class="px-4 py-3 text-xs">№</th> | |
58 | + <th class="px-4 py-3 text-xs">Имя</th> | |
59 | + <th class="px-4 py-3 text-xs">Email/логин</th> | |
60 | + <th class="px-4 py-3 text-xs">Работодатель/работник/администратор</th> | |
63 | 61 | @if ($id_admin == 1) |
64 | - <th class="px-4 py-3">Админ</th> | |
62 | + <th class="px-4 py-3 text-xs">Админ</th> | |
65 | 63 | @endif |
66 | - <th class="px-4 py-3">Дата регист.</th> | |
64 | + <th class="px-4 py-3 text-xs">Дата регист.</th> | |
67 | 65 | </tr> |
68 | 66 | </thead> |
69 | 67 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> |
70 | 68 | @foreach($users as $user) |
71 | 69 | <tr class="text-gray-700 dark:text-gray-400"> |
72 | - <td class="px-4 py-3"> | |
70 | + <td class="px-4 py-3 text-xs"> | |
73 | 71 | {{$user->id}} |
74 | 72 | </td> |
75 | - <td class="px-4 py-3"> | |
76 | - <!--<div class="flex items-center text-sm"> | |
77 | - <div class="relative hidden w-8 h-8 mr-3 rounded-full md:block"> | |
78 | - <div | |
79 | - class="absolute inset-0 rounded-full shadow-inner" | |
80 | - aria-hidden="true" | |
81 | - ></div> | |
82 | - </div> | |
83 | - <div> | |
84 | - <p class="font-semibold"><a href="{{ route('admin.users') }}">Пользователи</a></p> | |
85 | - <p class="text-xs text-gray-600 dark:text-gray-400"> | |
86 | - Все пользователи сайта | |
87 | - </p> | |
88 | - </div> | |
89 | - </div> | |
90 | - --> | |
91 | - <a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}">{{ $user->name }}</a> | |
73 | + <td class="px-4 py-3 text-xs"> | |
74 | + <a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}">{{ $user->name }}</a> | |
92 | 75 | </td> |
93 | - <td class="px-4 py-3 text-sm"> | |
76 | + <td class="px-4 py-3 text-xs"> | |
94 | 77 | {{ $user->email }} |
95 | 78 | </td> |
96 | 79 | <td class="px-4 py-3 text-xs"> |
... | ... | @@ -112,25 +95,16 @@ |
112 | 95 | </span> |
113 | 96 | @endif |
114 | 97 | </td> |
115 | - <td class="px-4 py-3 text-sm"> | |
116 | - @if ($user->id > 1) | |
117 | - <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_ban" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/> | |
118 | - @endif | |
119 | - </td> | |
120 | - | |
121 | - <td class="px-4 py-3 text-sm"> | |
122 | - <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_new" name="new_{{$user->id}}" {{ ($user->is_new) ? "checked" : "" }}/> | |
123 | - </td> | |
124 | 98 | |
125 | 99 | @if ($id_admin == 1) |
126 | - <td class="px-4 py-3 text-sm"> | |
100 | + <td class="px-4 py-3 text-xs"> | |
127 | 101 | @if ($user->id > 1) |
128 | 102 | <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/> |
129 | 103 | @endif |
130 | 104 | </td> |
131 | 105 | @endif |
132 | 106 | |
133 | - <td class="px-4 py-3 text-sm"> | |
107 | + <td class="px-4 py-3 text-xs"> | |
134 | 108 | {{ date('d.m.Y', strtotime($user->created_at)) }} |
135 | 109 | </td> |
136 | 110 | </tr> |
resources/views/admin/users/index_ajax.blade.php
... | ... | @@ -4,65 +4,60 @@ |
4 | 4 | <tr |
5 | 5 | class="text-xs font-semibold tracking-wide text-left text-gray-500 uppercase border-b dark:border-gray-700 bg-gray-50 dark:text-gray-400 dark:bg-gray-800" |
6 | 6 | > |
7 | - <th class="px-4 py-3">№</th> | |
8 | - <th class="px-4 py-3">Имя</th> | |
9 | - <th class="px-4 py-3">Email/логин</th> | |
10 | - <th class="px-4 py-3">Работодатель/работник/администратор</th> | |
11 | - <th class="px-4 py-3">Бан</th> | |
12 | - <th class="px-4 py-3">Новый</th> | |
7 | + <th class="px-4 py-3 text-xs">№</th> | |
8 | + <th class="px-4 py-3 text-xs">Имя</th> | |
9 | + <th class="px-4 py-3 text-xs">Email/логин</th> | |
10 | + <th class="px-4 py-3 text-xs">Работодатель/работник/администратор</th> | |
13 | 11 | @if ($id_admin == 1) |
14 | - <th class="px-4 py-3">Админ</th> | |
12 | + <th class="px-4 py-3 text-xs">Админ</th> | |
15 | 13 | @endif |
16 | - <th class="px-4 py-3">Дата регистрации</th> | |
14 | + <th class="px-4 py-3 text-xs">Дата регист.</th> | |
17 | 15 | </tr> |
18 | 16 | </thead> |
19 | 17 | <tbody class="bg-white divide-y dark:divide-gray-700 dark:bg-gray-800"> |
20 | 18 | @foreach($users as $user) |
21 | - <tr class="text-gray-700 dark:text-gray-400"> | |
22 | - <td class="px-4 py-3"> | |
23 | - {{$user->id}} | |
24 | - </td> | |
25 | - <td class="px-4 py-3"> | |
26 | - {{ $user->name }} | |
27 | - </td> | |
28 | - <td class="px-4 py-3 text-sm"> | |
29 | - {{ $user->email }} | |
30 | - </td> | |
31 | - <td class="px-4 py-3 text-xs"> | |
19 | + <tr class="text-gray-700 dark:text-gray-400"> | |
20 | + <td class="px-4 py-3 text-xs"> | |
21 | + {{$user->id}} | |
22 | + </td> | |
23 | + <td class="px-4 py-3 text-xs"> | |
24 | + <a style="text-decoration: underline;" href="{{ route('admin.user-profile', ['user' => $user->id]) }}">{{ $user->name }}</a> | |
25 | + </td> | |
26 | + <td class="px-4 py-3 text-xs"> | |
27 | + {{ $user->email }} | |
28 | + </td> | |
29 | + <td class="px-4 py-3 text-xs"> | |
32 | 30 | <span class="px-2 py-1 font-semibold leading-tight text-green-700 bg-green-100 rounded-full dark:bg-green-700 dark:text-green-100"> |
33 | 31 | @if ($user->is_worker) |
34 | - Работник | |
35 | - @else | |
36 | - Работодатель | |
37 | - @endif | |
32 | + Работник | |
33 | + @else | |
34 | + Работодатель | |
35 | + @endif | |
38 | 36 | </span> |
39 | - @if ($user->admin) | |
40 | - <span class="px-2 py-1 font-semibold leading-tight text-orange-700 bg-orange-100 rounded-full dark:text-white dark:bg-orange-600"> | |
37 | + @if ($user->admin) | |
38 | + <span class="px-2 py-1 font-semibold leading-tight text-orange-700 bg-orange-100 rounded-full dark:text-white dark:bg-orange-600"> | |
41 | 39 | Администратор |
42 | 40 | </span> |
43 | - @endif | |
44 | - </td> | |
45 | - <td class="px-4 py-3 text-sm"> | |
46 | - @if ($user->id > 1) | |
47 | - <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_ban" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/> | |
48 | - @endif | |
49 | - </td> | |
50 | - <td class="px-4 py-3 text-sm"> | |
51 | - <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="is_new" name="new_{{$user->id}}" {{ ($user->is_new) ? "checked" : "" }}/> | |
52 | - </td> | |
53 | - | |
54 | - @if ($id_admin == 1) | |
55 | - <td class="px-4 py-3 text-sm"> | |
56 | - @if ($user->id > 1) | |
57 | - <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/> | |
41 | + @endif | |
42 | + @if ($user->is_bd) | |
43 | + <span class="px-2 py-1 font-semibold leading-tight text-red-700 bg-red-100 rounded-full dark:text-red-100 dark:bg-red-700"> | |
44 | + База данных | |
45 | + </span> | |
58 | 46 | @endif |
59 | 47 | </td> |
60 | - @endif | |
61 | 48 | |
62 | - <td class="px-4 py-3 text-sm"> | |
63 | - {{ date('d.m.Y', strtotime($user->created_at)) }} | |
64 | - </td> | |
65 | - </tr> | |
49 | + @if ($id_admin == 1) | |
50 | + <td class="px-4 py-3 text-xs"> | |
51 | + @if ($user->id > 1) | |
52 | + <input type="checkbox" class="check_click" value="{{$user->id}}" data-field="admin" name="admin_{{$user->id}}" {{ ($user->admin) ? "checked" : "" }}/> | |
53 | + @endif | |
54 | + </td> | |
55 | + @endif | |
56 | + | |
57 | + <td class="px-4 py-3 text-xs"> | |
58 | + {{ date('d.m.Y', strtotime($user->created_at)) }} | |
59 | + </td> | |
60 | + </tr> | |
66 | 61 | @endforeach |
67 | 62 | </tbody> |
68 | 63 | </table> |
resources/views/layout/admin.blade.php
... | ... | @@ -32,14 +32,14 @@ |
32 | 32 | href="{{ route('admin.index') }}"> |
33 | 33 | Админка |
34 | 34 | </a> |
35 | + | |
35 | 36 | <ul class="mt-6"> |
37 | + @if (($is_manager == 1) || ($admin == 1)) | |
36 | 38 | <li class="relative px-6 py-3"> |
37 | - <span | |
38 | - class="absolute inset-y-0 left-0 w-1 bg-purple-600 rounded-tr-lg rounded-br-lg" | |
39 | - aria-hidden="true" | |
40 | - ></span> | |
41 | - <!--class="inline-flex items-center w-full text-sm font-semibold text-gray-800 transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 dark:text-gray-100" | |
42 | - --> | |
39 | + <span | |
40 | + class="absolute inset-y-0 left-0 w-1 bg-purple-600 rounded-tr-lg rounded-br-lg" | |
41 | + aria-hidden="true" | |
42 | + ></span> | |
43 | 43 | <a |
44 | 44 | class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.index') ? 'dark:text-gray-100' : null }}" |
45 | 45 | href="{{ route('admin.index') }}" |
... | ... | @@ -61,9 +61,10 @@ |
61 | 61 | <span class="ml-4">Главная страница</span> |
62 | 62 | </a> |
63 | 63 | </li> |
64 | + @endif | |
64 | 65 | </ul> |
65 | 66 | <ul> |
66 | - @if ($UserId == 1) | |
67 | + @if (($UserId == 1) || ($admin == 1)) | |
67 | 68 | <li class="relative px-6 py-3"> |
68 | 69 | <a |
69 | 70 | class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.users') ? 'dark:text-gray-100' : null }}" |
... | ... | @@ -87,6 +88,33 @@ |
87 | 88 | </a> |
88 | 89 | </li> |
89 | 90 | @endif |
91 | + | |
92 | + @if ($admin == 1) | |
93 | + <!--<li class="relative px-6 py-3"> | |
94 | + <a | |
95 | + class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.users') ? 'dark:text-gray-100' : null }}" | |
96 | + href="{{ route('admin.admin_roles') }}" | |
97 | + > | |
98 | + <svg | |
99 | + class="w-5 h-5" | |
100 | + aria-hidden="true" | |
101 | + fill="none" | |
102 | + stroke-linecap="round" | |
103 | + stroke-linejoin="round" | |
104 | + stroke-width="2" | |
105 | + viewBox="0 0 24 24" | |
106 | + stroke="currentColor" | |
107 | + > | |
108 | + <path | |
109 | + d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01" | |
110 | + ></path> | |
111 | + </svg> | |
112 | + <span class="ml-4">Роли администраторов</span> | |
113 | + </a> | |
114 | + </li>--> | |
115 | + @endif | |
116 | + | |
117 | + @if ($admin == 1) | |
90 | 118 | <li class="relative px-6 py-3"> |
91 | 119 | <a |
92 | 120 | class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.admin-users') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.admin-users') }}" |
... | ... | @@ -108,6 +136,9 @@ |
108 | 136 | <span class="ml-4">Администраторы</span> |
109 | 137 | </a> |
110 | 138 | </li> |
139 | + @endif | |
140 | + | |
141 | + @if (($is_manager == 1) || ($admin == 1)) | |
111 | 142 | <li class="relative px-6 py-3"> |
112 | 143 | <a |
113 | 144 | class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.employers') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.employers') }}" |
... | ... | @@ -129,6 +160,9 @@ |
129 | 160 | <span class="ml-4">Работодатели</span> |
130 | 161 | </a> |
131 | 162 | </li> |
163 | + @endif | |
164 | + | |
165 | + @if (($is_manager == 1) || ($admin == 1)) | |
132 | 166 | <li class="relative px-6 py-3"> |
133 | 167 | <a |
134 | 168 | class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.workers') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.workers') }}" |
... | ... | @@ -151,6 +185,9 @@ |
151 | 185 | <span class="ml-4">Соискатели</span> |
152 | 186 | </a> |
153 | 187 | </li> |
188 | + @endif | |
189 | + | |
190 | + @if (($is_manager) || ($admin)) | |
154 | 191 | <li class="relative px-6 py-3"> |
155 | 192 | <a |
156 | 193 | class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.ad-employers') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.ad-employers') }}" |
... | ... | @@ -172,7 +209,9 @@ |
172 | 209 | <span class="ml-4">Вакансии</span> |
173 | 210 | </a> |
174 | 211 | </li> |
212 | + @endif | |
175 | 213 | |
214 | + @if ($admin) | |
176 | 215 | <li class="relative px-6 py-3"> |
177 | 216 | <a |
178 | 217 | class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.messages') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.messages') }}" |
... | ... | @@ -192,7 +231,9 @@ |
192 | 231 | <span class="ml-4">Сообщения все</span> |
193 | 232 | </a> |
194 | 233 | </li> |
234 | + @endif | |
195 | 235 | |
236 | + @if ($admin) | |
196 | 237 | <li class="relative px-6 py-3"> |
197 | 238 | <a |
198 | 239 | class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.admin-messages') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.admin-messages') }}" |
... | ... | @@ -212,7 +253,9 @@ |
212 | 253 | <span class="ml-4">Заявки на рассылку</span> |
213 | 254 | </a> |
214 | 255 | </li> |
256 | + @endif | |
215 | 257 | |
258 | + @if (($is_manager) || ($admin)) | |
216 | 259 | <li class="relative px-6 py-3"> |
217 | 260 | <a |
218 | 261 | class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.groups') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.groups') }}" |
... | ... | @@ -234,7 +277,9 @@ |
234 | 277 | <span class="ml-4">Группы пользователей</span> |
235 | 278 | </a> |
236 | 279 | </li> |
280 | + @endif | |
237 | 281 | |
282 | + @if (($is_manager) || ($admin)) | |
238 | 283 | <li class="relative px-6 py-3"> |
239 | 284 | <a class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.media') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.media') }}"> |
240 | 285 | <svg |
... | ... | @@ -254,6 +299,7 @@ |
254 | 299 | <span class="ml-4">Медиа</span> |
255 | 300 | </a> |
256 | 301 | </li> |
302 | + @endif | |
257 | 303 | |
258 | 304 | @if ($UserId == 1) |
259 | 305 | <li class="relative px-6 py-3"> |
... | ... | @@ -276,6 +322,8 @@ |
276 | 322 | </a> |
277 | 323 | </li> |
278 | 324 | @endif |
325 | + | |
326 | + @if (($is_manager) || ($admin)) | |
279 | 327 | <li class="relative px-6 py-3"> |
280 | 328 | <a |
281 | 329 | class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.basedata') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.basedata') }}" |
... | ... | @@ -295,7 +343,9 @@ |
295 | 343 | <span class="ml-4">Базы данных</span> |
296 | 344 | </a> |
297 | 345 | </li> |
346 | + @endif | |
298 | 347 | |
348 | + @if ($admin) | |
299 | 349 | <li class="relative px-6 py-3"> |
300 | 350 | <a |
301 | 351 | class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.education.index') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.education.index') }}" |
... | ... | @@ -317,7 +367,9 @@ |
317 | 367 | <span class="ml-4">Учебн.заведения</span> |
318 | 368 | </a> |
319 | 369 | </li> |
370 | + @endif | |
320 | 371 | |
372 | + @if ($admin) | |
321 | 373 | <li class="relative px-6 py-3"> |
322 | 374 | <a |
323 | 375 | class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.statics') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.statics') }}" |
... | ... | @@ -340,6 +392,9 @@ |
340 | 392 | <span class="ml-4">Статистика</span> |
341 | 393 | </a> |
342 | 394 | </li> |
395 | + @endif | |
396 | + | |
397 | + @if (($is_manager) || ($admin)) | |
343 | 398 | <li class="relative px-6 py-3"> |
344 | 399 | <a |
345 | 400 | class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.answers') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.answers') }}" |
... | ... | @@ -359,6 +414,9 @@ |
359 | 414 | <span class="ml-4">Модерация</span> |
360 | 415 | </a> |
361 | 416 | </li> |
417 | + @endif | |
418 | + | |
419 | + @if (($is_manager) || ($admin)) | |
362 | 420 | <li class="relative px-6 py-3"> |
363 | 421 | <a |
364 | 422 | class="inline-flex items-center w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200 {{ Request::routeIs('admin.reclames') ? 'dark:text-gray-100' : null }}" href="{{ route('admin.reclames') }}" |
... | ... | @@ -380,7 +438,10 @@ |
380 | 438 | <span class="ml-4">Реклама</span> |
381 | 439 | </a> |
382 | 440 | </li> |
441 | + @endif | |
442 | + | |
383 | 443 | <!-- Справочники --> |
444 | + @if ($admin) | |
384 | 445 | <li class="relative px-6 py-3" x-data="{ open1: false }"> |
385 | 446 | <button |
386 | 447 | class="inline-flex items-center justify-between w-full text-sm font-semibold transition-colors duration-150 hover:text-gray-800 dark:hover:text-gray-200" |
... | ... | @@ -442,8 +503,10 @@ |
442 | 503 | </ul> |
443 | 504 | </template> |
444 | 505 | </li> |
506 | + @endif | |
445 | 507 | |
446 | 508 | |
509 | + @if ($admin) | |
447 | 510 | <!-- Редактор --> |
448 | 511 | <li class="relative px-6 py-3"> |
449 | 512 | <button |
... | ... | @@ -512,6 +575,7 @@ |
512 | 575 | </ul> |
513 | 576 | </template> |
514 | 577 | </li> |
578 | + @endif | |
515 | 579 | |
516 | 580 | </ul> |
517 | 581 | <!--<div class="px-6 my-6"> |
routes/web.php
... | ... | @@ -356,6 +356,8 @@ Route::group([ |
356 | 356 | // кабинет - роли пользователя |
357 | 357 | Route::get('roles', [UsersController::class, 'roles'])->name('roles'); |
358 | 358 | |
359 | + Route::get('admin_roles', [UsersController::class, 'admin_roles'])->name('admin_roles'); | |
360 | + | |
359 | 361 | Route::get('logs', function() { |
360 | 362 | $files = Storage::files('logs/laravel.log'); |
361 | 363 | print_r($files); |