Commit 2c692f9c05378b62f89151d96de9cfb9c1765273
1 parent
48baec8dae
Exists in
master
and in
1 other branch
Коммит обновление по сообщениям, без ошибок вроде
Showing 2 changed files with 3 additions and 2 deletions Inline Diff
app/Models/infobloks.php
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace App\Models; | 3 | namespace App\Models; |
4 | 4 | ||
5 | use Illuminate\Database\Eloquent\Factories\HasFactory; | 5 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
6 | use Illuminate\Database\Eloquent\Model; | 6 | use Illuminate\Database\Eloquent\Model; |
7 | 7 | ||
8 | class infobloks extends Model | 8 | class infobloks extends Model |
9 | { | 9 | { |
10 | use HasFactory; | 10 | use HasFactory; |
11 | 11 | ||
12 | protected $fillable = [ | 12 | protected $fillable = [ |
13 | 'name', | 13 | 'name', |
14 | 'is_remove', | 14 | 'is_remove', |
15 | 'sort', | 15 | 'sort', |
16 | ]; | 16 | ]; |
17 | 17 | ||
18 | public function ScopeActive($query) { | 18 | public function ScopeActive($query) { |
19 | return $query->where('is_remove', '=', '0'); | 19 | return $query->where('is_remove', '=', '0'); |
20 | } | 20 | } |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * Связь модели Инфоблоки (Infobloks) с моделью Доп.информация (dop_info) | 23 | * Связь модели Инфоблоки (Infobloks) с моделью Доп.информация (dop_info) |
24 | один-ко-многим | 24 | один-ко-многим |
25 | */ | 25 | */ |
26 | public function model_dop_info() { | 26 | public function model_dop_info() { |
27 | return $this->hasMany(dop_info::class, 'infoblok_id'); | 27 | return $this->hasMany(Dop_info::class, 'infoblok_id'); |
28 | } | 28 | } |
29 | } | 29 | } |
30 | 30 |
resources/views/workers/messages.blade.php
1 | @extends('layout.frontend', ['title' => 'Мои сообщения - РекаМоре']) | 1 | @extends('layout.frontend', ['title' => 'Мои сообщения - РекаМоре']) |
2 | 2 | ||
3 | @section('scripts') | 3 | @section('scripts') |
4 | 4 | ||
5 | @endsection | 5 | @endsection |
6 | 6 | ||
7 | @section('content') | 7 | @section('content') |
8 | <section class="cabinet"> | 8 | <section class="cabinet"> |
9 | <div class="container"> | 9 | <div class="container"> |
10 | <ul class="breadcrumbs cabinet__breadcrumbs"> | 10 | <ul class="breadcrumbs cabinet__breadcrumbs"> |
11 | <li><a href="{{ route('index') }}">Главная</a></li> | 11 | <li><a href="{{ route('index') }}">Главная</a></li> |
12 | <li><b>Личный кабинет</b></li> | 12 | <li><b>Личный кабинет</b></li> |
13 | </ul> | 13 | </ul> |
14 | <div class="cabinet__wrapper"> | 14 | <div class="cabinet__wrapper"> |
15 | <div class="cabinet__side"> | 15 | <div class="cabinet__side"> |
16 | <div class="cabinet__side-toper"> | 16 | <div class="cabinet__side-toper"> |
17 | @include('workers.emblema') | 17 | @include('workers.emblema') |
18 | 18 | ||
19 | </div> | 19 | </div> |
20 | 20 | ||
21 | @include('workers.menu', ['item' => 2]) | 21 | @include('workers.menu', ['item' => 2]) |
22 | </div> | 22 | </div> |
23 | <div class="cabinet__body"> | 23 | <div class="cabinet__body"> |
24 | <div class="cabinet__body-item"> | 24 | <div class="cabinet__body-item"> |
25 | <h2 class="title cabinet__title">Сообщения</h2> | 25 | <h2 class="title cabinet__title">Сообщения</h2> |
26 | </div> | 26 | </div> |
27 | <div class="cabinet__body-item"> | 27 | <div class="cabinet__body-item"> |
28 | <div class="cabinet__filters"> | 28 | <div class="cabinet__filters"> |
29 | <div class="cabinet__filters-item"> | 29 | <div class="cabinet__filters-item"> |
30 | <div class="cabinet__filters-buttons"> | 30 | <div class="cabinet__filters-buttons"> |
31 | <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="button button_light @if ($type_message == 'input') active @endif">Входящие ({{ $count_input }})</a> | 31 | <a href="{{ route('worker.messages', ['type_message' => 'input']) }}" class="button button_light @if ($type_message == 'input') active @endif">Входящие ({{ $count_input }})</a> |
32 | <a href="{{ route('worker.messages', ['type_message' => 'output']) }}" class="button button_light @if ($type_message == 'output') active @endif">Исходящие ({{ $count_output }})</a> | 32 | <a href="{{ route('worker.messages', ['type_message' => 'output']) }}" class="button button_light @if ($type_message == 'output') active @endif">Исходящие ({{ $count_output }})</a> |
33 | </div> | 33 | </div> |
34 | </div> | 34 | </div> |
35 | <!--<div class="cabinet__filters-item"> | 35 | <!--<div class="cabinet__filters-item"> |
36 | <div class="select"> | 36 | <div class="select"> |
37 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> | 37 | <select class="js-select2" id="sort_ajax" name="sort_ajax"> |
38 | <option value="default">Сортировка (по умолчанию)</option> | 38 | <option value="default">Сортировка (по умолчанию)</option> |
39 | <option value="name (asc)">По имени (возрастание)</option> | 39 | <option value="name (asc)">По имени (возрастание)</option> |
40 | <option value="name (desc)">По имени (убывание)</option> | 40 | <option value="name (desc)">По имени (убывание)</option> |
41 | <option value="created_at (asc)">По дате (возрастание)</option> | 41 | <option value="created_at (asc)">По дате (возрастание)</option> |
42 | <option value="created_at (desc)">По дате (убывание)</option> | 42 | <option value="created_at (desc)">По дате (убывание)</option> |
43 | </select> | 43 | </select> |
44 | </div> | 44 | </div> |
45 | </div>--> | 45 | </div>--> |
46 | </div> | 46 | </div> |
47 | @if ($messages->count()) | 47 | @if ($messages->count()) |
48 | @foreach($messages as $it) | 48 | @foreach($messages as $it) |
49 | <div class="messages__item"> | 49 | <div class="messages__item"> |
50 | <div class="messages__item-info"> | 50 | <div class="messages__item-info"> |
51 | <!--<pre> print_r(asset(Storage::url($it->user_from->employers[0]->logo))) }}</pre>--> | 51 | <!--<pre> print_r(asset(Storage::url($it->user_from->employers[0]->logo))) }}</pre>--> |
52 | <div class="messages__item-photo"> | 52 | <div class="messages__item-photo"> |
53 | <svg> | 53 | <svg> |
54 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> | 54 | <use xlink:href="{{ asset('images/sprite.svg#pic') }}"></use> |
55 | </svg> | 55 | </svg> |
56 | 56 | <!-- Комментарий: обновление структуры вывода картинок, все корректное --> | |
57 | @if ($type_message == 'input') | 57 | @if ($type_message == 'input') |
58 | @if ($it->user_from->is_worker) | 58 | @if ($it->user_from->is_worker) |
59 | @if (isset($it->user_from->workers[0]->photo)) | 59 | @if (isset($it->user_from->workers[0]->photo)) |
60 | <img src="{{ asset(Storage::url($it->user_to->workers[0]->photo)) }}" alt=""> | 60 | <img src="{{ asset(Storage::url($it->user_to->workers[0]->photo)) }}" alt=""> |
61 | @else | 61 | @else |
62 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 62 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
63 | @endif | 63 | @endif |
64 | @else | 64 | @else |
65 | @if (isset($it->user_from->employers[0]->logo)) | 65 | @if (isset($it->user_from->employers[0]->logo)) |
66 | <img src="{{ asset(Storage::url($it->user_from->employers[0]->logo)) }}" alt=""> | 66 | <img src="{{ asset(Storage::url($it->user_from->employers[0]->logo)) }}" alt=""> |
67 | @else | 67 | @else |
68 | <img src=" asset('images/default_man.jpg') }}" alt=""> | 68 | <img src=" asset('images/default_man.jpg') }}" alt=""> |
69 | @endif | 69 | @endif |
70 | @endif | 70 | @endif |
71 | @endif | 71 | @endif |
72 | 72 | ||
73 | <!-- Обновление исходящих сообщений - фотографии компании и работника --> | ||
73 | @if ($type_message == 'output') | 74 | @if ($type_message == 'output') |
74 | @if ($it->user_from->is_worker) | 75 | @if ($it->user_from->is_worker) |
75 | @if (isset($it->user_from->workers[0]->photo)) | 76 | @if (isset($it->user_from->workers[0]->photo)) |
76 | <img src="{{ asset(Storage::url($it->user_from->workers[0]->photo)) }}" alt=""> | 77 | <img src="{{ asset(Storage::url($it->user_from->workers[0]->photo)) }}" alt=""> |
77 | @else | 78 | @else |
78 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 79 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
79 | @endif | 80 | @endif |
80 | @else | 81 | @else |
81 | @if (isset($it->user_from->employers->logo)) | 82 | @if (isset($it->user_from->employers->logo)) |
82 | <img src="{{ asset(Storage::url($it->user_from->employers->logo)) }}" alt=""> | 83 | <img src="{{ asset(Storage::url($it->user_from->employers->logo)) }}" alt=""> |
83 | @else | 84 | @else |
84 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> | 85 | <img src="{{ asset('images/default_man.jpg') }}" alt=""> |
85 | @endif | 86 | @endif |
86 | @endif | 87 | @endif |
87 | @endif | 88 | @endif |
88 | </div> | 89 | </div> |
89 | <div class="messages__item-text"> | 90 | <div class="messages__item-text"> |
90 | <div> | 91 | <div> |
91 | От: @if (isset($it->user_from)) | 92 | От: @if (isset($it->user_from)) |
92 | @if ($it->user_from->id !== $user_id) | 93 | @if ($it->user_from->id !== $user_id) |
93 | <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id]) }}" style="text-decoration: underline"> | 94 | <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_from->id]) }}" style="text-decoration: underline"> |
94 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} | 95 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} |
95 | </a> | 96 | </a> |
96 | @else | 97 | @else |
97 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} | 98 | {{ $it->user_from->surname." ".$it->user_from->name_man." ".$it->user_from->surname2." (".$it->user_from->id.")" }} |
98 | @endif | 99 | @endif |
99 | @else | 100 | @else |
100 | Удаленный пользователь | 101 | Удаленный пользователь |
101 | @endif | 102 | @endif |
102 | <br> | 103 | <br> |
103 | К: @if (isset($it->user_to)) | 104 | К: @if (isset($it->user_to)) |
104 | @if ($it->user_to->id !== $user_id) | 105 | @if ($it->user_to->id !== $user_id) |
105 | <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id]) }}" style="text-decoration: underline"> | 106 | <a href="{{ route('worker.dialog', ['user1' => $user_id, 'user2' => $it->user_to->id]) }}" style="text-decoration: underline"> |
106 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} | 107 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} |
107 | </a> | 108 | </a> |
108 | @else | 109 | @else |
109 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} | 110 | {{ $it->user_to->surname." ".$it->user_to->name_man." ".$it->user_to->surname2." (".$it->user_to->id.")" }} |
110 | @endif | 111 | @endif |
111 | @else | 112 | @else |
112 | Удаленный пользователь | 113 | Удаленный пользователь |
113 | @endif | 114 | @endif |
114 | </div> | 115 | </div> |
115 | <div><span>Вакансия:</span>@if (isset($it->vacancies)) {{ $it->vacancies->name." (".($it->vacancies->id).")" }} @else Удалена @endif</div> | 116 | <div><span>Вакансия:</span>@if (isset($it->vacancies)) {{ $it->vacancies->name." (".($it->vacancies->id).")" }} @else Удалена @endif</div> |
116 | <div><span>Текст:</span>{{ $it->text }}</div> | 117 | <div><span>Текст:</span>{{ $it->text }}</div> |
117 | </div> | 118 | </div> |
118 | </div> | 119 | </div> |
119 | <div class="messages__item-date">{{ $it->created_at }}</div> | 120 | <div class="messages__item-date">{{ $it->created_at }}</div> |
120 | </div> | 121 | </div> |
121 | @endforeach | 122 | @endforeach |
122 | 123 | ||
123 | <div style="margin-top: 20px"> | 124 | <div style="margin-top: 20px"> |
124 | {{ $messages->onEachSide(0)->appends($_GET)->links('paginate') }} | 125 | {{ $messages->onEachSide(0)->appends($_GET)->links('paginate') }} |
125 | </div><!-- конец --> | 126 | </div><!-- конец --> |
126 | 127 | ||
127 | @else | 128 | @else |
128 | <div class="notify"> | 129 | <div class="notify"> |
129 | <svg> | 130 | <svg> |
130 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> | 131 | <use xlink:href="{{ asset('images/sprite.svg#i') }}"></use> |
131 | </svg> | 132 | </svg> |
132 | <span>Сообщений не найдено</span> | 133 | <span>Сообщений не найдено</span> |
133 | </div> | 134 | </div> |
134 | @endif | 135 | @endif |
135 | </div> | 136 | </div> |
136 | </div> | 137 | </div> |
137 | </div> | 138 | </div> |
138 | </div> | 139 | </div> |
139 | </section> | 140 | </section> |
140 | </div> | 141 | </div> |
141 | <div> | 142 | <div> |
142 | @endsection | 143 | @endsection |
143 | 144 |