photo/app/Console/Commands/CatalogDump.php
2020-01-03 08:04:15 +11:00

45 lines
779 B
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Traits\Type;
class CatalogDump extends Command
{
use Type;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'catalog:dump {type : Photo | Video } {id : Photo ID}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Scan Photo for metadata';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$class = $this->getModelType($this->argument('type'));
$o = $class::findOrFail($this->argument('id'));
if (! $o->isReadable()) {
$this->warn(sprintf('Ignoring [%s], it is not readable',$o->file_path()));
exit;
}
dump($o->properties());
}
}