2022-04-19 07:07:39 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models\Service;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class Phone (Service)
|
|
|
|
* Services that are Voice Telephony
|
|
|
|
*/
|
2022-04-22 01:47:46 +00:00
|
|
|
class Phone extends Type
|
2022-04-19 07:07:39 +00:00
|
|
|
{
|
|
|
|
protected $table = 'service_phone';
|
|
|
|
|
|
|
|
/* INTERFACES */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the service address
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getServiceDescriptionAttribute(): string
|
|
|
|
{
|
|
|
|
return strtoupper($this->service_address) ?: '-';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the service number
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getServiceNameAttribute(): string
|
|
|
|
{
|
|
|
|
return $this->service_number ?: ($this->service_address ?: '-');
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ATTRIBUTES */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of technology used to provide this Internet Service
|
|
|
|
*
|
|
|
|
* @param $value
|
|
|
|
* @return null|string
|
|
|
|
*/
|
|
|
|
public function getTechnologyAttribute($value): ?string
|
|
|
|
{
|
|
|
|
return $value ?: $this->supplied()->technology;
|
|
|
|
}
|
2022-08-01 22:49:17 +00:00
|
|
|
|
|
|
|
/* OVERRIDES */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Service update validation
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function validation(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'service_number' => 'nullable|string|min:10|max:10',
|
2022-09-29 07:45:43 +00:00
|
|
|
'service_address' => 'nullable|string|min:3',
|
2022-08-01 22:49:17 +00:00
|
|
|
'service_username' => 'nullable|string',
|
|
|
|
'service_password' => 'nullable|string',
|
|
|
|
'connect_at' => 'nullable|date',
|
|
|
|
'start_at' => 'nullable|date',
|
|
|
|
'expire_at' => 'nullable|date|after:start_at',
|
|
|
|
];
|
|
|
|
}
|
2022-04-19 07:07:39 +00:00
|
|
|
}
|