Commit f0b6d25e98632aa5b60c0ddb0e55effc81d4319f

Authored by Андрей Ларионов
1 parent 32cbe77364

Баг с id юзеров в блоке работодатели и redis коннектор

Showing 5 changed files with 24 additions and 9 deletions Side-by-side Diff

app/Http/Controllers/Admin/EmployersController.php
... ... @@ -33,7 +33,7 @@ class EmployersController extends Controller
33 33 });
34 34 }*/
35 35  
36   - $users = User::select(['users.*', 'emp.id as emp_id', 'emp.*'])->join('employers as emp','emp.user_id','users.id')
  36 + $users = User::select(['users.*','users.id as usr_id', 'emp.id as emp_id', 'emp.*'])->join('employers as emp','emp.user_id','users.id')
37 37 ->where('users.is_worker', '0');
38 38 $find_key = "";
39 39 if (isset($request->find)) {
app/Http/Controllers/PagesController.php
... ... @@ -4,6 +4,7 @@ namespace App\Http\Controllers;
4 4  
5 5 use App\Models\pages;
6 6 use Illuminate\Http\Request;
  7 +use Illuminate\Support\Facades\Redis;
7 8  
8 9 class PagesController extends Controller
9 10 {
... ... @@ -11,4 +12,16 @@ class PagesController extends Controller
11 12 $page = pages::query()->where('slug', $pages->slug)->first();
12 13 print_r($page);
13 14 }
  15 +
  16 + public function redis() {
  17 + $redis = Redis::connection();
  18 + $redis->set('User:CompanyName', 'РЕКАМОРЕ');
  19 + $id = 1;
  20 + //dd(Redis::get('MyVar'));
  21 + $redis->command('rpush', array("Сообщение1"));
  22 + $redis->command('rpush', array("Сообщение2"));
  23 + $values = $redis->command('lrange', array("mylist", 0, 1));
  24 + dd($values);
  25 +
  26 + }
14 27 }
resources/views/admin/employer/index.blade.php
... ... @@ -86,7 +86,7 @@
86 86  
87 87 </td>
88 88 <td class="px-4 py-3 text-sm">
89   - {{ $user->name_man }} ({{ $user->emp_id }})
  89 + {{ $user->name_man }} ({{ $user->usr_id }})
90 90 </td>
91 91 <td class="px-4 py-3 text-sm">
92 92 {{ $user->created_at }}
... ... @@ -97,8 +97,8 @@
97 97 @endif
98 98 </td>
99 99 <td class="px-4 py-3 text-sm">
100   - @if ($user->id > 1)
101   - <input type="checkbox" class="checkban" value="{{$user->id}}" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/>
  100 + @if ($user->usr_id > 1)
  101 + <input type="checkbox" class="checkban" value="{{$user->usr_id}}" name="ban_{{$user->usr_id}}" {{ ($user->is_ban) ? "checked" : "" }}/>
102 102 @endif
103 103 </td>
104 104 </tr>
resources/views/admin/employer/index_ajax.blade.php
... ... @@ -40,19 +40,19 @@
40 40  
41 41 </td>
42 42 <td class="px-4 py-3 text-sm">
43   - {{ $user->name_man }}
  43 + {{ $user->name_man }} ({{ $user->usr_id }})
44 44 </td>
45 45 <td class="px-4 py-3 text-sm">
46 46 {{ $user->created_at }}
47 47 </td>
48 48 <td class="px-4 py-3 text-sm">
49   - @if ($user->id > 1)
50   - <a href="{{ route('admin.user-profile', ['user' => $user->id]) }}">Изменить</a>
  49 + @if (!empty($user->emp_id))
  50 + <a href="{{ route('admin.employer-profile', ['employer' => $user->emp_id]) }}">Изменить</a>
51 51 @endif
52 52 </td>
53 53 <td class="px-4 py-3 text-sm">
54   - @if ($user->id > 1)
55   - <input type="checkbox" class="checkban" value="{{$user->id}}" name="ban_{{$user->id}}" {{ ($user->is_ban) ? "checked" : "" }}/>
  54 + @if ($user->usr_id > 1)
  55 + <input type="checkbox" class="checkban" value="{{$user->usr_id}}" name="ban_{{$user->usr_id}}" {{ ($user->is_ban) ? "checked" : "" }}/>
56 56 @endif
57 57 </td>
58 58 </tr>
... ... @@ -273,3 +273,5 @@ Route::group([
273 273 Route::post('ckeditor/upload', [CKEditorController::class, 'upload'])->name('ckeditor.image-upload');
274 274  
275 275 Route::get('pages/{pages:slug}', [PagesController::class, 'pages'])->name('page');
  276 +
  277 +Route::get('redis/', [PagesController::class, 'redis'])->name('redis');