Currency   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 28
dl 0
loc 60
c 0
b 0
f 0
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
1
<?php
2
3
namespace PWWEB\Localisation\Models;
4
5
use Eloquent as Model;
6
use PWWEB\Core\Traits\Migratable;
7
use PWWEB\Localisation\Contracts\Currency as CurrencyContract;
8
9
/**
10
 * App\Models\Pwweb\Localisation\Models\Currency Model.
11
 *
12
 * Standard Currency Model.
13
 *
14
 * @author    Frank Pillukeit <[email protected]>
15
 * @author    Richard Browne <[email protected]
16
 * @copyright 2020 pw-websolutions.com
17
 * @license   http://www.opensource.org/licenses/mit-license.html  MIT License
18
 * @property  string name
19
 * @property  string iso
20
 * @property  int numeric_code
21
 * @property  string entity_code
22
 * @property  bool active
23
 * @property  bool standard
24
 */
25
class Currency extends Model implements CurrencyContract
26
{
27
    use Migratable;
28
29
    const CREATED_AT = 'created_at';
30
    const UPDATED_AT = 'updated_at';
31
32
    /**
33
     * The attributes that can be filled.
34
     *
35
     * @var string[]
36
     */
37
    public $fillable = [
38
        'name',
39
        'iso',
40
        'numeric_code',
41
        'entity_code',
42
        'active',
43
        'standard',
44
    ];
45
46
    /**
47
     * The attributes that should be casted to native types.
48
     *
49
     * @var array
50
     */
51
    protected $casts = [
52
        'id' => 'integer',
53
        'name' => 'string',
54
        'iso' => 'string',
55
        'numeric_code' => 'integer',
56
        'entity_code' => 'string',
57
        'active' => 'boolean',
58
        'standard' => 'boolean',
59
    ];
60
61
    /**
62
     * Validation rules.
63
     *
64
     * @var array
65
     */
66
    public static $rules = [
67
        'name' => 'required',
68
        'iso' => 'required',
69
        'numeric_code' => 'required',
70
        'entity_code' => 'required',
71
        'active' => 'required',
72
        'standard' => 'required',
73
    ];
74
75
    /**
76
     * Constructor.
77
     *
78
     * @param array $attributes additional attributes for model initialisation
79
     */
80
    public function __construct(array $attributes = [])
81
    {
82
        parent::__construct($attributes);
83
84
        $this->setTable(config('pwweb.localisation.table_names.currencies'));
85
    }
86
}
87