diff --git a/app/Http/Controllers/EmployerController.php b/app/Http/Controllers/EmployerController.php index 3d7104d..a0cdaed 100644 --- a/app/Http/Controllers/EmployerController.php +++ b/app/Http/Controllers/EmployerController.php @@ -390,14 +390,9 @@ class EmployerController extends Controller $chat_id = $request->get('id'); $is_fixed = $request->get('is_fixed'); - $new_state = Chat::pin_chat($chat_id, $is_fixed); - - if ($new_state !== null) { - $message = $new_state ? 'Сообщение закреплено' : 'Сообщение откреплено'; - return redirect()->back()->with('success', $message); - } - - return redirect()->back()->withErrors(['message' => 'Ошибка: сообщение не удалось обновить.']); + $chat = Chat::pin_chat($chat_id, $is_fixed); + $message = $chat->is_fixed ? 'Сообщение закреплено' : 'Сообщение откреплено'; + return redirect()->back()->with('success', $message); } public function remove_chat(Request $request){ diff --git a/app/Models/Chat.php b/app/Models/Chat.php index e6199ce..329156c 100644 --- a/app/Models/Chat.php +++ b/app/Models/Chat.php @@ -49,12 +49,12 @@ class Chat extends Model public static function pin_chat(int $chat_id, $fixed) { - - return self::where('id', '=', $chat_id) - ->update([ + $chat = self::query()->find($chat_id); + $chat->update([ 'is_fixed' => !empty($fixed) ? 1 : 0, 'fixation_date' => !empty($fixed) ? Carbon::now() : null ]); + return $chat; } public static function remove_chat(int $chat_id) diff --git a/resources/views/employers/bd.blade.php b/resources/views/employers/bd.blade.php index 4f7cecb..bbb8ed4 100644 --- a/resources/views/employers/bd.blade.php +++ b/resources/views/employers/bd.blade.php @@ -148,6 +148,7 @@ + @@ -163,6 +164,10 @@ @foreach ($users as $key => $it) @php $worker = !empty($it->workers[0]) ? $it->workers[0] : ''; @endphp + +
ФИО соискателя Должность Наличие
анкеты
+ {{ $it->workers[0]->comment }} + {{ $it->surname." ".$it->name_man }}
{{ $it->surname2 }}
diff --git a/resources/views/employers/edit_vacancy.blade.php b/resources/views/employers/edit_vacancy.blade.php index a40e259..8cc3923 100644 --- a/resources/views/employers/edit_vacancy.blade.php +++ b/resources/views/employers/edit_vacancy.blade.php @@ -154,9 +154,9 @@
@error('text') - - {{ $message }} - + + {{ $message }} + @enderror
@@ -172,7 +172,23 @@