osb/app/Models/ServiceSsl.php
2018-08-11 15:21:15 +10:00

43 lines
661 B
PHP

<?php
namespace App\Models;
use App\Models\Service_Model as Model;
use App\Traits\NextKey;
use App\Classes\SSL;
class ServiceSsl extends Model
{
use NextKey;
protected $table = 'ab_service__ssl';
protected $_o = NULL;
public function tld()
{
return $this->belongsTo(DomainTld::class,'domain_tld_id');
}
public function getSSLAttribute()
{
if (is_null($this->_o))
{
$this->_o = new SSL;
if ($this->cert)
$this->_o->crt($this->cert);
if ($this->csr)
$this->_o->csr($this->csr);
if ($this->pk)
$this->_o->key($this->pk);
}
return $this->_o;
}
public function getNameAttribute()
{
return $this->ssl->cn;
}
}