Update source into github
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ModuleIpAddress extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'module_ip_address';
|
||||
|
||||
protected $fillable = [
|
||||
'vm_name',
|
||||
'module_host_id',
|
||||
'module_network_id',
|
||||
'ip',
|
||||
'gateway',
|
||||
'netmask',
|
||||
'dns',
|
||||
'status'
|
||||
];
|
||||
public function host()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\ModuleHost::class,'module_host_id','id');
|
||||
}
|
||||
public function network()
|
||||
{
|
||||
return $this->belongsTo(\App\Models\ModuleNetwork::class,'module_network_id','id');
|
||||
|
||||
}
|
||||
public function scopeIsFree(Builder $query)
|
||||
{
|
||||
$query->where('status',0);
|
||||
}
|
||||
public function getStatus()
|
||||
{
|
||||
return match($this->attributes['status']) {
|
||||
1 => '<span class="badge badge-info">Assigned</span>',
|
||||
default => '<span class="badge bg-success">Free</span>'
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user