Files
futurewalker/app/Jobs/PublishRssSearchResultJob.php
Charles Teh e374875015 Update (ui): fix word break
Update (top rss keyword): do not show known brands
2023-11-23 10:50:43 +08:00

51 lines
1.1 KiB
PHP

<?php
namespace App\Jobs;
use Exception;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use LaravelFreelancerNL\LaravelIndexNow\Facades\IndexNow;
use LaravelGoogleIndexing;
class PublishRssSearchResultJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $query;
public $timeout = 30;
/**
* Create a new job instance.
*/
public function __construct(string $query)
{
$this->query = $query;
}
/**
* Execute the job.
*/
public function handle(): void
{
if ((app()->environment() == 'production') && (config('platform.global.indexing'))) {
$url = get_route_search_result(strtolower($this->query));
try {
IndexNow::submit($url);
} catch (Exception) {
}
try {
LaravelGoogleIndexing::create()->update($url);
} catch (Exception) {
}
}
}
}