photo/app/Console/Commands/CatalogDump.php

45 lines
779 B
PHP
Raw Normal View History

2018-01-11 12:59:53 +00:00
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
2020-01-02 21:04:15 +00:00
use App\Traits\Type;
2018-01-11 12:59:53 +00:00
class CatalogDump 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: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()
2018-01-11 12:59:53 +00:00
{
2020-01-02 21:04:15 +00:00
$class = $this->getModelType($this->argument('type'));
$o = $class::findOrFail($this->argument('id'));
2018-01-11 12:59:53 +00:00
2020-01-02 21:04:15 +00:00
if (! $o->isReadable()) {
$this->warn(sprintf('Ignoring [%s], it is not readable',$o->file_path()));
exit;
}
dump($o->properties());
}
}