2018-01-11 12:59:53 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
2024-08-31 12:23:07 +00:00
|
|
|
use App\Jobs\CatalogScan as Job;
|
2020-01-02 21:04:15 +00:00
|
|
|
use App\Traits\Type;
|
|
|
|
|
2018-01-11 12:59:53 +00:00
|
|
|
class CatalogScan extends Command
|
|
|
|
{
|
2020-01-02 21:04:15 +00:00
|
|
|
use Type;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2024-09-02 12:51:19 +00:00
|
|
|
protected $signature = 'catalog:scan'
|
|
|
|
.' {type : Photo | Video }'
|
|
|
|
.' {id : Photo ID}'
|
|
|
|
.' {--dirty : Show Dirty}';
|
2020-01-02 21:04:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The console command description.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2024-08-31 12:23:07 +00:00
|
|
|
protected $description = 'Scan Photo/Video for metadata';
|
2020-01-02 21:04:15 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
$class = $this->getModelType($this->argument('type'));
|
2019-11-09 02:52:04 +00:00
|
|
|
|
|
|
|
$o = $class::findOrFail($this->argument('id'));
|
2019-11-08 10:43:36 +00:00
|
|
|
|
2024-08-31 12:23:07 +00:00
|
|
|
return Job::dispatchSync($o);
|
2020-01-02 21:04:15 +00:00
|
|
|
}
|
|
|
|
}
|