photo/app/Jobs/PhotoMove.php
2020-01-05 09:37:50 +11:00

40 lines
709 B
PHP

<?php
namespace App\Jobs;
use Illuminate\Support\Facades\Log;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Artisan;
use App\Models\Photo;
class PhotoMove extends Job implements ShouldQueue
{
use InteractsWithQueue,SerializesModels;
public $photo;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Photo $o)
{
$this->photo = $o;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
Log::info(sprintf('%s: Moving [%s]',__METHOD__,$this->photo->id));
Artisan::call('photo:move',['--id' => $this->photo->id]);
}
}