Start of console commands enhancements
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user