photo/app/Jobs/CatalogScan.php

40 lines
790 B
PHP
Raw Normal View History

2018-01-11 12:59:53 +00:00
<?php
namespace App\Jobs;
2019-11-09 02:52:04 +00:00
use Illuminate\Contracts\Queue\ShouldQueue;
2018-01-11 12:59:53 +00:00
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
2019-11-09 02:52:04 +00:00
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Artisan;
use App\Models\Abstracted\Catalog;
2018-01-11 12:59:53 +00:00
class CatalogScan extends Job implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
// Our object
private $o = NULL;
/**
* Create a new job instance.
*
* @return void
*/
2019-11-09 02:52:04 +00:00
public function __construct(Catalog $o) {
2018-01-11 12:59:53 +00:00
$this->o = $o;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
Log::info(sprintf('%s: Scanning [%s|%s]',__METHOD__,$this->o->objecttype(),$this->o->id));
2019-11-09 02:52:04 +00:00
2018-01-11 12:59:53 +00:00
Artisan::call('catalog:scan',['type'=>$this->o->objecttype(),'id'=>$this->o->id]);
}
2019-11-09 02:52:04 +00:00
}