diff --git a/app/Console/Commands/Nostr/PublishUnpublishedItems.php b/app/Console/Commands/Nostr/PublishUnpublishedItems.php index 7d56b693..05e5e61b 100644 --- a/app/Console/Commands/Nostr/PublishUnpublishedItems.php +++ b/app/Console/Commands/Nostr/PublishUnpublishedItems.php @@ -28,16 +28,19 @@ class PublishUnpublishedItems extends Command { config(['app.user-timezone' => 'Europe/Berlin']); $modelName = $this->option('model'); - $className = '\\App\Models\\'.$modelName; + $className = '\\App\Models\\' . $modelName; $model = $className::query() - ->whereNull('nostr_status') - ->when($modelName === 'BitcoinEvent', fn($q) => $q->where('from', '>', now())) - ->when($modelName === 'CourseEvent', fn($q) => $q->where('from', '>', now())) - ->when($modelName === 'MeetupEvent', fn($q) => $q->where('start', '>', now())) - ->when($modelName === 'LibraryItem', fn($q) => $q->where('type', '<>', 'markdown_article')) - ->orderByDesc('created_at') - ->first(); - if ($model){ + ->whereNull('nostr_status') + ->when($modelName === 'BitcoinEvent', fn($q) => $q->where('from', '>', now())) + ->when($modelName === 'CourseEvent', fn($q) => $q->where('from', '>', now())) + ->when($modelName === 'MeetupEvent', fn($q) => $q->where('start', '>', now())) + ->when($modelName === 'LibraryItem', fn($q) => $q + ->where('type', '<>', 'markdown_article') + ->where('type', '<>', 'bindle') + ) + ->orderByDesc('created_at') + ->first(); + if ($model) { $this->publishOnNostr($model, $this->getText($model)); } }