Start of console commands enhancements

This commit is contained in:
Deon George
2020-01-03 08:04:15 +11:00
parent c5fcfdc1d7
commit cf7c9317eb
6 changed files with 131 additions and 127 deletions

View File

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