trypost/app/Jobs/PublishPost.php
2026-01-14 22:13:44 -03:00

23 lines
482 B
PHP

<?php
namespace App\Jobs;
use App\Models\Post;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
class PublishPost implements ShouldQueue
{
use Queueable;
public function __construct(public Post $post) {}
public function handle(): void
{
$this->post->markAsPublishing();
foreach ($this->post->postPlatforms as $postPlatform) {
PublishToSocialPlatform::dispatch($postPlatform);
}
}
}