photo/app/Console/Commands/CatalogMove.php

43 lines
728 B
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Jobs\CatalogMove as Job;
use App\Traits\Type;
class CatalogMove extends Command
{
use Type;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'catalog:move'
.' {type : Photo | Video }'
.' {id : Photo ID}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Move Photo/Video based on their meta data';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$class = $this->getModelType($this->argument('type'));
$o = $class::findOrFail($this->argument('id'));
return Job::dispatchSync($o);
}
}