. */ namespace Poniverse\Ponyfm\Jobs; use DB; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Database\Eloquent\Model; use Illuminate\Queue\InteractsWithQueue; use Poniverse\Ponyfm\Contracts\Searchable; use Poniverse\Ponyfm\Jobs\Job; use Illuminate\Contracts\Bus\SelfHandling; use SerializesModels; class UpdateSearchIndexForEntity extends Job implements SelfHandling, ShouldQueue { use InteractsWithQueue, SerializesModels; protected $entity; /** * Create a new job instance. * * @param Model $entity */ public function __construct(Searchable $entity) { $this->entity = $entity; } /** * Execute the job. * * @return void */ public function handle() { $this->beforeHandle(); $this->entity->updateElasticsearchEntrySynchronously(); } }