Fix showing packet dump on view packet, change Address::active() to not take into account zone/domain

This commit is contained in:
Deon George 2023-07-06 15:50:46 +10:00
parent 36d03d1c12
commit 7073fece94
2 changed files with 12 additions and 5 deletions

View File

@ -60,7 +60,7 @@ class Address extends Model
/* SCOPES */ /* SCOPES */
public function scopeActive($query) public function scopeActiveFTN($query)
{ {
return $query->select($this->getTable().'.*') return $query->select($this->getTable().'.*')
->join('zones',['zones.id'=>'addresses.zone_id']) ->join('zones',['zones.id'=>'addresses.zone_id'])
@ -378,6 +378,7 @@ class Address extends Model
* @param string $address * @param string $address
* @param bool $create * @param bool $create
* @param System|null $so * @param System|null $so
* @param bool $trashed
* @return Address|null * @return Address|null
* @throws \Exception * @throws \Exception
*/ */
@ -388,6 +389,9 @@ class Address extends Model
// Are we looking for a region address // Are we looking for a region address
if (($ftn['f'] === 0) && $ftn['p'] === 0) { if (($ftn['f'] === 0) && $ftn['p'] === 0) {
$o = (new self) $o = (new self)
->select('addresses.*')
->join('zones',['zones.id'=>'addresses.zone_id'])
->join('domains',['domains.id'=>'zones.domain_id'])
->when($trashed,function($query) { ->when($trashed,function($query) {
$query->trashed(); $query->trashed();
},function($query) { },function($query) {
@ -416,6 +420,9 @@ class Address extends Model
} }
$o = (new self) $o = (new self)
->select('addresses.*')
->join('zones',['zones.id'=>'addresses.zone_id'])
->join('domains',['domains.id'=>'zones.domain_id'])
->when($trashed,function($query) { ->when($trashed,function($query) {
$query->trashed(); $query->trashed();
},function($query) { },function($query) {

View File

@ -60,7 +60,7 @@
@foreach($results as $item) @foreach($results as $item)
@foreach ($item as $file => $result) @foreach ($item as $file => $result)
<h3 class="accordion-header" data-bs-toggle="collapse" data-bs-target="#collapse_item_{{ $loop->parent->index }}_{{ $loop->index }}" aria-expanded="false">Packet Results <strong class="highlight">{{ $file }}</strong></h3> <h3 class="accordion-header" data-bs-toggle="collapse" data-bs-target="#collapse_item_{{ $loop->parent->index }}_{{ $loop->index }}" aria-expanded="false">Packet Results <strong class="highlight">{{ $file }}</strong></h3>
<div id="collapse_item_{{ $loop->parent->index }}_{{ $loop->index }}" class="accordion-collapse collapse @if($result->messages->count() === 1 && $loop->parent->first)show @endif" aria-labelledby="packetdebug" data-bs-parent="#accordion_packet"> <div id="collapse_item_{{ $loop->parent->index }}_{{ $loop->index }}" class="accordion-collapse collapse @if($loop->parent->first)show @endif" aria-labelledby="packetdebug" data-bs-parent="#accordion_packet">
<div class="accordion-body"> <div class="accordion-body">
<p>Packet <strong class="highlight">{{ $file }}</strong> (type <strong class="highlight">{{ $result->type }}</strong>) is from <strong class="highlight">{{ $result->fftn }}</strong> to <strong class="highlight">{{ $result->tftn }}</strong>, dated <strong class="highlight">{{ $result->date }}</strong>.</p> <p>Packet <strong class="highlight">{{ $file }}</strong> (type <strong class="highlight">{{ $result->type }}</strong>) is from <strong class="highlight">{{ $result->fftn }}</strong> to <strong class="highlight">{{ $result->tftn }}</strong>, dated <strong class="highlight">{{ $result->date }}</strong>.</p>
<p>This packet has <strong class="highlight">{{ $result->messages->count() }}</strong> messages and <strong class="highlight">{{ $result->password ? 'DOES' : 'does NOT' }}</strong> have a password.</p> <p>This packet has <strong class="highlight">{{ $result->messages->count() }}</strong> messages and <strong class="highlight">{{ $result->password ? 'DOES' : 'does NOT' }}</strong> have a password.</p>
@ -152,13 +152,14 @@
</div> </div>
</div> </div>
@endforeach
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<h4 class="accordion-header" id="packetdebug_{{ $loop->parent->parent->index }}" data-bs-toggle="collapse" data-bs-target="#collapse_hex_{{ $loop->parent->parent->index }}" aria-expanded="false"> <h4 class="accordion-header" id="packetdebug}" data-bs-toggle="collapse" data-bs-target="#collapse_hex" aria-expanded="false">
Packet Dump Packet Dump
</h4> </h4>
<div id="collapse_hex_{{ $loop->parent->parent->index }}" class="accordion-collapse collapse" aria-labelledby="packetdebug_{{ $loop->parent->parent->index }}" data-bs-parent="#accordion_file_{{ $loop->parent->parent->index }}"> <div id="collapse_hex" class="accordion-collapse collapse" aria-labelledby="packetdebug" data-bs-parent="#accordion_file">
<div class="accordion-body"> <div class="accordion-body">
<pre> <pre>
{{ $hexdump }} {{ $hexdump }}
@ -167,7 +168,6 @@
</div> </div>
</div> </div>
</div> </div>
@endforeach
</div> </div>
</div> </div>
</div> </div>