Implement creator studio and upload updates

This commit is contained in:
2026-04-04 10:12:02 +02:00
parent 1da7d3bf88
commit 0b216b7ecd
15107 changed files with 31206 additions and 626514 deletions

View File

@@ -8,6 +8,7 @@ use App\Jobs\NovaCards\RenderNovaCardPreviewJob;
use App\Models\NovaCard;
use App\Services\NovaCards\NovaCardPublishModerationService;
use Illuminate\Support\Carbon;
use InvalidArgumentException;
class NovaCardPublishService
{
@@ -24,6 +25,8 @@ class NovaCardPublishService
'status' => NovaCard::STATUS_PROCESSING,
'moderation_status' => NovaCard::MOD_PENDING,
'published_at' => $card->published_at ?? Carbon::now(),
'scheduled_for' => null,
'scheduling_timezone' => null,
'render_version' => (int) $card->render_version + 1,
])->save();
@@ -39,6 +42,8 @@ class NovaCardPublishService
'status' => NovaCard::STATUS_PROCESSING,
'moderation_status' => NovaCard::MOD_PENDING,
'published_at' => $card->published_at ?? Carbon::now(),
'scheduled_for' => null,
'scheduling_timezone' => null,
'render_version' => (int) $card->render_version + 1,
])->save();
@@ -52,4 +57,33 @@ class NovaCardPublishService
return $card->refresh()->load(['category', 'template', 'tags', 'backgroundImage']);
}
public function schedule(NovaCard $card, Carbon $scheduledFor, ?string $timezone = null): NovaCard
{
$scheduledFor = $scheduledFor->copy()->utc();
if ($scheduledFor->lte(now()->addMinute())) {
throw new InvalidArgumentException('Scheduled publish time must be at least 1 minute in the future.');
}
$card->forceFill([
'status' => NovaCard::STATUS_SCHEDULED,
'scheduled_for' => $scheduledFor,
'published_at' => $scheduledFor,
'scheduling_timezone' => $timezone,
])->save();
return $card->refresh()->load(['category', 'template', 'tags', 'backgroundImage']);
}
public function clearSchedule(NovaCard $card): NovaCard
{
$card->forceFill([
'status' => NovaCard::STATUS_DRAFT,
'scheduled_for' => null,
'published_at' => null,
])->save();
return $card->refresh()->load(['category', 'template', 'tags', 'backgroundImage']);
}
}