Passed
Push — master ( 25567b...280d06 )
by Innocent
02:56
created

Profile::getMissionAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace FaithGen\SDK\Models\Ministry;
4
5
use FaithGen\SDK\Models\UuidModel;
6
use FaithGen\SDK\Traits\Relationships\Belongs\BelongsToMinistryTrait;
7
8
class Profile extends UuidModel
9
{
10
    use  BelongsToMinistryTrait;
11
12
    protected $table = 'fg_profiles';
13
14
    protected $casts = [
15
        'location' => 'array',
16
        'phones'   => 'array',
17
        'emails'   => 'array',
18
    ];
19
20
    //****************************************************************************//
21
    //***************************** MODEL ATTRIBUTES *****************************//
22
    //****************************************************************************///
23
24
    public function getVisionAttribute($val)
25
    {
26
        return ucfirst($val);
27
    }
28
29
    public function getMissionAttribute($val)
30
    {
31
        return ucfirst($val);
32
    }
33
34
    public function getLocationAttribute($location)
35
    {
36
        if (! $location) {
37
            return [
38
                'address'     => [
39
                    'name'      => 'not-set',
40
                    'formatted' => 'not-set',
41
                ],
42
                'locality'    => 'not-set',
43
                'country'     => 'not-set',
44
                'postal_code' => 'not-set',
45
            ];
46
        }
47
48
        return $location;
49
    }
50
51
    //****************************************************************************//
52
    //***************************** MODEL ATTRIBUTES *****************************//
53
    //****************************************************************************//
54
}
55