2019-12-22 11:16:31 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
2024-09-02 12:51:19 +00:00
|
|
|
use App\Jobs\CatalogMove as Job;
|
|
|
|
use App\Traits\Type;
|
2019-12-22 11:16:31 +00:00
|
|
|
|
|
|
|
class CatalogMove extends Command
|
|
|
|
{
|
2024-09-02 12:51:19 +00:00
|
|
|
use Type;
|
2019-12-22 11:16:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2024-09-02 12:51:19 +00:00
|
|
|
protected $signature = 'catalog:move'
|
|
|
|
.' {type : Photo | Video }'
|
|
|
|
.' {id : Photo ID}';
|
2019-12-22 11:16:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The console command description.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2024-09-02 12:51:19 +00:00
|
|
|
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()
|
|
|
|
{
|
2024-09-02 12:51:19 +00:00
|
|
|
$class = $this->getModelType($this->argument('type'));
|
2019-12-22 11:16:31 +00:00
|
|
|
|
2024-09-02 12:51:19 +00:00
|
|
|
$o = $class::findOrFail($this->argument('id'));
|
2019-12-22 11:16:31 +00:00
|
|
|
|
2024-09-02 12:51:19 +00:00
|
|
|
return Job::dispatchSync($o);
|
2019-12-22 11:16:31 +00:00
|
|
|
}
|
2024-09-02 12:51:19 +00:00
|
|
|
}
|