photo/app/Jobs/CatalogScan.php
2019-11-09 13:52:04 +11:00

40 lines
790 B
PHP

<?php
namespace App\Jobs;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Artisan;
use App\Models\Abstracted\Catalog;
class CatalogScan extends Job implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
// Our object
private $o = NULL;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Catalog $o) {
$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));
Artisan::call('catalog:scan',['type'=>$this->o->objecttype(),'id'=>$this->o->id]);
}
}