Initial echomail import
This commit is contained in:
25
app/Models/Echomail.php
Normal file
25
app/Models/Echomail.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Echomail extends Model
|
||||
{
|
||||
protected $dates = ['date'];
|
||||
|
||||
public function kludges()
|
||||
{
|
||||
return $this->belongsToMany(Kludge::class);
|
||||
}
|
||||
|
||||
public function seenbys()
|
||||
{
|
||||
return $this->belongsToMany(Seenby::class,NULL,NULL,'node_id');
|
||||
}
|
||||
|
||||
public function paths()
|
||||
{
|
||||
return $this->belongsToMany(Path::class,NULL,NULL,'node_id');
|
||||
}
|
||||
}
|
10
app/Models/Kludge.php
Normal file
10
app/Models/Kludge.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Kludge extends Model
|
||||
{
|
||||
//
|
||||
}
|
@@ -6,12 +6,17 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Node extends Model
|
||||
{
|
||||
protected $fillable = ['zone_id','host_id','node_id'];
|
||||
protected $fillable = ['zone_id','host_id','node_id','point_id'];
|
||||
|
||||
public function flags() {
|
||||
return $this->belongsToMany(Flag::class);
|
||||
}
|
||||
|
||||
public function getFTNAttribute()
|
||||
{
|
||||
return sprintf('%s:%s/%s.%s',$this->zone_id,$this->host_id,$this->node_id,$this->point_id);
|
||||
}
|
||||
|
||||
public function hasFlag($relation, $model)
|
||||
{
|
||||
return (bool) $this->{$relation}()
|
||||
|
10
app/Models/Path.php
Normal file
10
app/Models/Path.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Path extends Model
|
||||
{
|
||||
//
|
||||
}
|
10
app/Models/Seenby.php
Normal file
10
app/Models/Seenby.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Seenby extends Model
|
||||
{
|
||||
//
|
||||
}
|
Reference in New Issue
Block a user