2018-01-11 12:59:53 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
|
|
|
class CatalogDump extends Command
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* 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 = 'App\Model\\'.$this->argument('type');
|
2019-12-22 11:16:31 +00:00
|
|
|
|
2018-01-11 12:59:53 +00:00
|
|
|
if (! class_exists($class))
|
|
|
|
abort(500,sprintf('No class [%s]',$this->argument('type')));
|
|
|
|
|
|
|
|
$o = $class::findOrFail($this->argument('id'));
|
|
|
|
|
|
|
|
if (! is_readable($o->file_path()))
|
|
|
|
{
|
|
|
|
$this->warn(sprintf('Ignoring [%s], it is not readable',$o->file_path()));
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
print_r($o->properties());
|
|
|
|
}
|
|
|
|
}
|