37 lines
868 B
PHP
37 lines
868 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class DnsServer extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'dns_manager_servers';
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'ip_address',
|
|
'password',
|
|
'username',
|
|
'api_key',
|
|
'status',
|
|
];
|
|
|
|
public function getStatus(): string
|
|
{
|
|
return match ($this->attributes['status']) {
|
|
'activated' => '<span class="badge bg-success text-success-fg">Activated</span>',
|
|
'Stopped' => '<span class="badge bg-danger text-danger-fg">Stopped</span>',
|
|
default => '<span class="badge bg-secondary">Unknown</span>',
|
|
};
|
|
}
|
|
|
|
protected function scopeIsActive($query)
|
|
{
|
|
return $query->where('status', 'activated');
|
|
}
|
|
}
|