Added echomail search and display

This commit is contained in:
Deon George
2021-08-29 11:48:27 +10:00
parent 12f9ee1960
commit 271f066667
7 changed files with 99 additions and 2 deletions

View File

@@ -207,6 +207,11 @@ class Address extends Model
return sprintf('%s@%s',$this->getFTN4DAttribute(),$this->zone->domain->name);
}
public function getFTN2DAttribute(): string
{
return sprintf('%d/%d',$this->host_id ?: $this->region_id,$this->node_id);
}
public function getFTN3DAttribute(): string
{
return sprintf('%d:%d/%d',$this->zone->zone_id,$this->host_id ?: $this->region_id,$this->node_id);

View File

@@ -2,6 +2,7 @@
namespace App\Models;
use Illuminate\Support\Collection;
use Jenssegers\Mongodb\Eloquent\Model;
use Jenssegers\Mongodb\Eloquent\SoftDeletes;
@@ -32,6 +33,18 @@ class Echomail extends Model implements Packet
->withTrashed();
}
/* ATTRIBUTES */
public function getPathAttribute($value): Collection
{
return Address::whereIn('id',$value)->get()->pluck('ftn3d');
}
public function getSeenByAttribute($value): Collection
{
return Address::whereIn('id',$value)->get()->pluck('ftn2d');
}
/* METHODS */
public function jsonSerialize(): array