Initial commit

This commit is contained in:
Ronald Huynen
2026-03-23 21:37:59 +01:00
commit 2547717edb
2193 changed files with 972171 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?php
require __DIR__.'/vendor/autoload.php';
$app = require_once __DIR__.'/bootstrap/app.php';
$app->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap();
$posts = App\Models\Post::with('translations', 'category')
->whereIn('category_id', [4,5,6,7,8,113])
->get();
echo "Posts in allowed categories ({$posts->count()} total):\n";
echo str_repeat('=', 100) . "\n";
foreach ($posts as $post) {
$enTranslation = $post->translations->where('locale', 'en')->first();
if (!$enTranslation) {
echo "ID: {$post->id} | Cat: {$post->category_id} | NO ENGLISH TRANSLATION\n";
continue;
}
$now = now();
$fromDate = $enTranslation->from;
$tillDate = $enTranslation->till;
$deletedAt = $enTranslation->deleted_at;
$isVisible = true;
$reason = 'Visible';
// From date MUST exist and be in the past (null = NOT published)
if (!$fromDate) {
$isVisible = false;
$reason = "No publication date (from is null = unpublished)";
} elseif ($now->lt($fromDate)) {
$isVisible = false;
$reason = "Not yet published (from: {$fromDate})";
}
// Till date can be null (never expires) or must be in the future
if ($tillDate && $now->gt($tillDate)) {
$isVisible = false;
$reason = "Publication ended (till: {$tillDate})";
}
// Deleted date can be null (not deleted) or must be in the future
if ($deletedAt && $now->gte($deletedAt)) {
$isVisible = false;
$reason = 'Scheduled deletion';
}
$status = $isVisible ? '✓ VISIBLE' : '✗ HIDDEN';
$title = substr($enTranslation->title, 0, 40);
echo "ID: {$post->id} | Cat: {$post->category_id} | Title: {$title} | Status: {$status} | Reason: {$reason}\n";
}