36 lines
824 B
PHP
36 lines
824 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class NetworkScan extends Model
|
|
{
|
|
protected $fillable = [
|
|
'segment_id', 'subnet', 'source', 'scanner', 'total_hosts',
|
|
'online_hosts', 'new_devices', 'changed_devices',
|
|
'notes', 'created_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'created_at' => 'datetime',
|
|
];
|
|
|
|
public function hosts(): HasMany
|
|
{
|
|
return $this->hasMany(NetworkHost::class, 'scan_id');
|
|
}
|
|
|
|
public function creator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
|
|
public function segment(): BelongsTo
|
|
{
|
|
return $this->belongsTo(NetworkSegment::class, 'segment_id');
|
|
}
|
|
}
|