bindle api

This commit is contained in:
HolgerHatGarKeineNode
2023-08-18 21:03:52 +02:00
parent 448630734e
commit cab049f459

View File

@@ -28,16 +28,19 @@ class PublishUnpublishedItems extends Command
{ {
config(['app.user-timezone' => 'Europe/Berlin']); config(['app.user-timezone' => 'Europe/Berlin']);
$modelName = $this->option('model'); $modelName = $this->option('model');
$className = '\\App\Models\\'.$modelName; $className = '\\App\Models\\' . $modelName;
$model = $className::query() $model = $className::query()
->whereNull('nostr_status') ->whereNull('nostr_status')
->when($modelName === 'BitcoinEvent', fn($q) => $q->where('from', '>', now())) ->when($modelName === 'BitcoinEvent', fn($q) => $q->where('from', '>', now()))
->when($modelName === 'CourseEvent', 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 === 'MeetupEvent', fn($q) => $q->where('start', '>', now()))
->when($modelName === 'LibraryItem', fn($q) => $q->where('type', '<>', 'markdown_article')) ->when($modelName === 'LibraryItem', fn($q) => $q
->orderByDesc('created_at') ->where('type', '<>', 'markdown_article')
->first(); ->where('type', '<>', 'bindle')
if ($model){ )
->orderByDesc('created_at')
->first();
if ($model) {
$this->publishOnNostr($model, $this->getText($model)); $this->publishOnNostr($model, $this->getText($model));
} }
} }