2024-05-28 00:44:33 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands\Debug;
|
|
|
|
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
|
|
|
use App\Classes\File\Send;
|
|
|
|
use App\Classes\File\Send\Dynamic;
|
|
|
|
use App\Models\Address;
|
|
|
|
use App\Models\Dynamic as DynamicModel;
|
|
|
|
|
|
|
|
class DynamicItem extends Command
|
|
|
|
{
|
|
|
|
protected $signature = 'debug:dynamic:item'
|
2024-12-01 10:35:13 +00:00
|
|
|
.' {name : Dynamic Item}';
|
2024-05-28 00:44:33 +00:00
|
|
|
|
|
|
|
protected $description = 'Generate a dynamic item';
|
|
|
|
|
|
|
|
public function handle(): int
|
|
|
|
{
|
|
|
|
$do = DynamicModel::where('name',$this->argument('name'))->single();
|
|
|
|
|
|
|
|
if (! $do)
|
|
|
|
throw new \Exception(sprintf('Dynamic Item [%s] doesnt exist?',$this->argument('name')));
|
|
|
|
|
2024-12-01 10:35:13 +00:00
|
|
|
$d = new Dynamic($do,$do->address,Send::T_FILE);
|
2024-05-28 00:44:33 +00:00
|
|
|
|
|
|
|
$d->open();
|
|
|
|
echo $d->read($d->size);
|
|
|
|
|
|
|
|
return self::SUCCESS;
|
|
|
|
}
|
|
|
|
}
|