2019-06-07 06:54:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models\Service;
|
|
|
|
|
2022-04-19 07:07:39 +00:00
|
|
|
use App\Models\DomainRegistrar;
|
2022-04-22 01:47:46 +00:00
|
|
|
use App\Traits\ServiceDomains;
|
2019-06-13 04:32:34 +00:00
|
|
|
|
2021-07-13 02:31:56 +00:00
|
|
|
/**
|
|
|
|
* Class Domain (Service)
|
2022-04-19 07:07:39 +00:00
|
|
|
* Services that are managed Domain Names
|
2021-07-13 02:31:56 +00:00
|
|
|
*/
|
2022-04-22 01:47:46 +00:00
|
|
|
class Domain extends Type
|
2019-06-07 06:54:27 +00:00
|
|
|
{
|
2022-04-19 07:07:39 +00:00
|
|
|
use ServiceDomains;
|
2019-06-13 04:32:34 +00:00
|
|
|
|
2022-04-19 07:07:39 +00:00
|
|
|
protected $table = 'service_domain';
|
2020-02-10 11:07:46 +00:00
|
|
|
protected $with = ['tld'];
|
2019-06-07 06:54:27 +00:00
|
|
|
|
2022-08-02 09:16:52 +00:00
|
|
|
/* OVERRIDES */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Service update validation
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function validation(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'domain_name' => 'nullable|string|min:2',
|
|
|
|
'tld_id' => 'required|exists:tlds,id',
|
|
|
|
'domain_registrar_id' => 'required|exists:domain_registrars,id',
|
|
|
|
'registrar_account' => 'nullable|string',
|
|
|
|
'registrar_ns' => 'nullable|string',
|
|
|
|
'registrar_username' => 'nullable|string',
|
2022-10-18 03:17:50 +00:00
|
|
|
'connect_at' => 'nullable|date',
|
|
|
|
'start_at' => 'nullable|date',
|
|
|
|
'expire_at' => 'nullable|date|after:start_at',
|
|
|
|
'recur_schedule' => 'nullable|int', // @todo insure value is at least 1 yr and not higher than Invoice::billing_periods
|
2022-08-02 09:16:52 +00:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2021-07-13 02:31:56 +00:00
|
|
|
/* RELATIONS */
|
|
|
|
|
2020-02-19 12:37:45 +00:00
|
|
|
public function registrar()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(DomainRegistrar::class,'domain_registrar_id');
|
|
|
|
}
|
2019-06-07 06:54:27 +00:00
|
|
|
}
|