You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
/**
|
|
* DetectLog Model
|
|
*/
|
|
|
|
use App\Utils\Tools;
|
|
|
|
class DetectLog extends Model
|
|
{
|
|
protected $connection = "default";
|
|
protected $table = "detect_log";
|
|
|
|
public function DetectRule()
|
|
{
|
|
$rule = DetectRule::where("id", $this->attributes['list_id'])->first();
|
|
if ($rule == null) {
|
|
DetectLog::where('id', '=', $this->attributes['id'])->delete();
|
|
return null;
|
|
} else {
|
|
return $rule;
|
|
}
|
|
}
|
|
|
|
public function User()
|
|
{
|
|
$user = User::where("id", $this->attributes['user_id'])->first();
|
|
if ($user == null) {
|
|
DetectLog::where('id', '=', $this->attributes['id'])->delete();
|
|
return null;
|
|
} else {
|
|
return $user;
|
|
}
|
|
}
|
|
|
|
public function Node()
|
|
{
|
|
$node = Node::where("id", $this->attributes['node_id'])->first();
|
|
if ($node == null) {
|
|
DetectLog::where('id', '=', $this->attributes['id'])->delete();
|
|
return null;
|
|
} else {
|
|
return $node;
|
|
}
|
|
}
|
|
}
|