my-idlers/app/Models/DNS.php

35 lines
843 B
PHP
Raw Normal View History

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
class DNS extends Model
{
use HasFactory;
public $incrementing = false;
2022-07-22 15:49:18 +02:00
protected $keyType = 'string';
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'];
public static function dnsCount()
{
return Cache::remember('dns_count', now()->addMonth(1), function () {
2023-08-18 11:28:53 +02:00
return DNS::count();
});
}
public function note(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Note::class, 'service_id', 'id');
}
}