Total Complexity | 4 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Coverage | 75% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class CustomerContactPhones extends Model |
||
8 | { |
||
9 | protected $fillable = ['cont_id', 'phone_type_id', 'phone_number', 'extension']; |
||
10 | protected $appends = ['type_icon', 'type_name', 'readable']; |
||
11 | protected $hidden = ['created_at', 'updated_at']; |
||
12 | |||
13 | 2 | public function getTypeIconAttribute() |
|
14 | { |
||
15 | 2 | return PhoneNumberTypes::find($this->phone_type_id)->icon_class; |
|
16 | } |
||
17 | |||
18 | 4 | public function getTypeNameAttribute() |
|
21 | } |
||
22 | |||
23 | 4 | public function getReadableAttribute() |
|
24 | { |
||
25 | 4 | return preg_replace('~.*(\d{3})[^\d]*(\d{3})[^\d]*(\d{4}).*~', '($1) $2-$3', $this->phone_number); |
|
26 | } |
||
27 | |||
28 | public function PhoneNumberTypes() |
||
31 | } |
||
32 | } |
||
33 |