2022-03-05 16:02:12 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2022-05-14 16:15:20 +02:00
|
|
|
use Illuminate\Support\Facades\Cache;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
2022-03-05 16:02:12 +01:00
|
|
|
|
|
|
|
class DNS extends Model
|
|
|
|
{
|
|
|
|
use HasFactory;
|
|
|
|
|
|
|
|
public $incrementing = false;
|
|
|
|
|
2022-07-22 15:49:18 +02:00
|
|
|
protected $keyType = 'string';
|
|
|
|
|
2022-03-05 16:02:12 +01:00
|
|
|
protected $fillable = ['id', 'service_id', 'hostname', 'dns_type', 'address', 'server_id', 'domain_id'];
|
|
|
|
|
|
|
|
public static $dns_types = ['A', 'AAAA', 'DNAME', 'MX', 'NS', 'SOA', 'TXT', 'URI'];
|
2022-05-14 16:15:20 +02:00
|
|
|
|
|
|
|
public static function dnsCount()
|
|
|
|
{
|
|
|
|
return Cache::remember('dns_count', now()->addMonth(1), function () {
|
|
|
|
return DB::table('d_n_s')->count();
|
|
|
|
});
|
|
|
|
}
|
2022-12-02 03:57:28 +01:00
|
|
|
|
|
|
|
public function note(): \Illuminate\Database\Eloquent\Relations\HasOne
|
|
|
|
{
|
|
|
|
return $this->hasOne(Note::class, 'service_id', 'id');
|
|
|
|
}
|
|
|
|
|
2022-03-05 16:02:12 +01:00
|
|
|
}
|