Files
echoscoop/app/Jobs/PublishIndexPostJob.php
2023-09-26 01:47:14 +08:00

36 lines
721 B
PHP

<?php
namespace App\Jobs;
use App\Models\Post;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class PublishIndexPostJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $post;
/**
* Create a new job instance.
*/
public function __construct(Post $post)
{
$this->post = $post;
}
/**
* Execute the job.
*/
public function handle(): void
{
if (! is_null($this->post)) {
PublishIndexPostTask::handle($this->post);
}
}
}