This commit is contained in:
Richard Dern
2022-01-12 00:35:37 +01:00
commit 400e3d01f1
1363 changed files with 57778 additions and 0 deletions

66
app/Jobs/EnqueueFeedUpdate.php Executable file
View File

@@ -0,0 +1,66 @@
<?php
namespace App\Jobs;
use App\Models\Feed;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class EnqueueFeedUpdate implements ShouldQueue, ShouldBeUnique
{
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
/**
* Delete the job if its models no longer exist.
*
* @var bool
*/
public $deleteWhenMissingModels = true;
/**
* Feed to update.
*
* @var \App\Models\Feed
*/
protected $feed;
public $feedId = null;
/**
* Create a new job instance.
*/
public function __construct(Feed $feed)
{
$this->feed = $feed;
if (!empty($this->feed->id)) {
$this->feedId = $feed->id;
}
}
/**
* Execute the job.
*/
public function handle()
{
$this->feed->analyze();
$this->feed = null;
}
/**
* The unique ID of the job.
*
* @return string
*/
public function uniqueId()
{
return $this->feedId;
}
}