photo/app/Console/Commands/CatalogScan.php

44 lines
768 B
PHP
Raw Normal View History

2018-01-11 12:59:53 +00:00
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
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
*/
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
*/
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-09-16 12:10:19 +00:00
return Job::dispatchSync($o,$this->option('dirty'));
2020-01-02 21:04:15 +00:00
}
}