post->markAsPublishing(); foreach ($this->post->postPlatforms()->enabled()->get() as $postPlatform) { PublishToSocialPlatform::dispatch($postPlatform); } } public function failed(?\Throwable $exception): void { Log::error('PublishPost job failed', [ 'post_id' => $this->post->id, 'error' => $exception?->getMessage(), ]); $this->post->markAsFailed(); } }