clrghouz/app/Console/Commands/Debug/AddressCheck.php

32 lines
785 B
PHP
Raw Normal View History

<?php
namespace App\Console\Commands\Debug;
use Illuminate\Console\Command;
use App\Models\Address;
class AddressCheck extends Command
{
protected $signature = 'debug:address:check'
.' {ftn : FTN}';
protected $description = 'Check the addresses we use for a node';
public function handle()
{
$o = Address::findFTN($this->argument('ftn'));
if (! $o) {
$this->error(sprintf('Address: %s doesnt exist?',$this->argument('ftn')));
return Command::FAILURE;
}
$this->info(sprintf('Address: %s',$o->ftn));
$this->info(sprintf('Uplink: %s',$o->parent()?->ftn));
$this->info(sprintf('Our Address: %s',our_address($o)?->ftn));
$this->info(sprintf('Domain Addresses: %s',our_address($o->zone->domain)->pluck('ftn4d')->join(',')));
return Command::SUCCESS;
}
}