Initial echomail import

This commit is contained in:
Deon George
2019-04-27 23:57:39 +10:00
parent 6515c91270
commit 9ba790e72c
14 changed files with 387 additions and 20 deletions

32
app/Traits/GetNode.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
namespace App\Traits;
use App\Models\{Node,Zone};
trait GetNode
{
/**
* Get an FTN record
* If the record doesnt exist, we'll create it
*/
protected function get_node($z,$n,$f,$p=0,$create=TRUE)
{
$zo = Zone::firstOrCreate(['id'=>$z]);
$no = Node::firstOrNew(['zone_id'=>$zo->id,'host_id'=>$n,'node_id'=>$f,'point_id'=>$p]);
if (! $no->exists AND $create)
{
$no->active = FALSE;
$no->system = 'AUTO DISCOVERED';
$no->sysop = 'UNKNOWN';
$no->location = '';
$no->baud = 0;
$no->save();
}
return ($no->exists) ? $no : NULL;
}
}