photo/app/Console/Commands/CatalogMove.php

43 lines
728 B
PHP
Raw Permalink Normal View History

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