$users = DB::table('users')
->select('name', 'email', DB::raw('(SELECT COUNT(*) FROM posts WHERE posts.user_id = users.id) as post_count'))
->get();
$users = DB::select('SELECT users.name, users.email, (SELECT COUNT(*) FROM posts WHERE posts.user_id = users.id) as post_count FROM users');
<table id="table">
</table>
<script>
let table = document.getElementById("table");
for (let i = 0; i < 10; i++) {
let row = table.insertRow();
for (let j = 0; j < 10; j++) {
let cell = row.insertCell();
cell.innerHTML = Math.floor(Math.random() * 100) + 1;
}
}
</script>
const increment = (end - start) / (duration / 16) * (start < end ? 1 : -1);
if (increment > 0 ? current >= end : current <= end) {
<form id="download-form" action="/files/source/source.zip">
<button class="btn" disabled>Скачать</button>
</form>
<script>
document.getElementById('form').onchange = function () {
var button = document.body.getElementsByClassName('btn')[0];
button.disabled = !this.checked;
};
</script>
import io
import subprocess
script = "написанный скрипт"
file = io.StringIO(script)
subprocess.Popen(("C:\\Program Files\\Notepad++\\notepad++.exe", file.name), shell=True)
import tempfile
import subprocess
script = "написанный скрипт"
with tempfile.NamedTemporaryFile(delete=False) as file:
file.write(script.encode())
subprocess.Popen(("C:\\Program Files\\Notepad++\\notepad++.exe", file.name), shell=True)
<button onclick="window.open('https://www.example.com', '_blank', 'height=500,width=500')">Открыть окно</button>
"SELECT * FROM kategory WHERE id=:id AND name=:name"
"SELECT * FROM kategory WHERE id=:id OR name=:name"
Измените:
with open("txt.txt", "w", "utf-16") as file:
на