where('release_date', '<=', $now)
->where('release_date', '>', $week_ago)
->orderBy('source')
->get();
$gamebooks = [];
$quests_ru = [];
$quests_en = [];
$visualnovels = [];
$ru = Language::findByCode('ru');
foreach ($games as $game) {
$tags = $game->tags->pluck('title',' id')->toArray();
$tags = array_values($tags);
$tags = array_map('strtolower', $tags);
if (array_intersect([
'adult',
'xxx',
'18+',
'porn',
'porngame',
'pointnclick',
'lewd',
'erotic',
'nsfw',
'bitsy',
'vr',
], $tags) !== []) {
continue;
}
if (strpos($game->title, 'PDF') !== false) {
$gamebooks[] = $game;
}
else if ($game->source === 'Anivisual') {
$visualnovels[] = $game;
} else if ($game->languages->where('id', $ru->id)->first()) {
$quests_ru[] = $game;
} else {
if (empty($quests_en[$game->source])) {
$quests_en[$game->source] = [];
}
$quests_en[$game->source][] = $game;
}
}
if (!empty($gamebooks)) {
$this->printList('Книги-игры', $gamebooks);
}
if (!empty($visualnovels)) {
$this->printList('Визуальные новеллы', $visualnovels);
}
if (!empty($quests_ru)) {
$this->printList('Текстовые квесты', $quests_ru);
}
if (!empty($quests_en)) {
foreach ($quests_en as $source => $list) {
$this->printSpoiler($source, $list);
}
}
}
protected function printSpoiler($title, $list) {
echo '
'.$game->normalizeDescription($description).''; } echo '