table('chat') ->select('message') ->where('user_id', $userId) ->orderByDesc('chat_id') ->limit(1) ->first(); if (!$last || ($last->message ?? '') !== $tekst) { DB::connection('legacy')->table('chat')->insert([ 'time' => now(), 'sender' => $username, 'user_id' => $userId, 'message' => $tekst, ]); } } public function UpdateChatFile($chat_file, $num_rows) { $output = "'; @file_put_contents(base_path($chat_file), $output); } public function ShowOnline() { echo '
Loading...
'; } public function ShowChat($num_rows = 10, $username = null) { echo '
Loading...
'; echo '
'; if (!empty($_SESSION['web_login']['status'])) { echo '
'; echo '
'; echo ''; echo '
'; echo '
'; echo ''; echo '
'; echo ''; echo '
'; } else { echo '
You should be logged in to join a chat!
'; } echo '
'; } }