Rate   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 13
c 3
b 0
f 0
dl 0
loc 39
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A source() 0 3 1
A target() 0 3 1
1
<?php
2
3
namespace Orkhanahmadov\LaravelCurrencylayer\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Relations\BelongsTo;
7
8
/**
9
 * @property int $id
10
 * @property int $source_currency_id
11
 * @property int $target_currency_id
12
 * @property float $rate
13
 * @property int $timestamp
14
 */
15
class Rate extends Model
16
{
17
    /**
18
     * @var string
19
     */
20
    protected $table = 'currencylayer_rates';
21
    /**
22
     * @var bool
23
     */
24
    public $timestamps = false;
25
    /**
26
     * @var array<string>
27
     */
28
    protected $fillable = [
29
        'target_currency_id',
30
        'rate',
31
        'timestamp',
32
    ];
33
    /**
34
     * @var array<string>
35
     */
36
    protected $dates = [
37
        'timestamp',
38
    ];
39
    /**
40
     * @var array<string>
41
     */
42
    protected $casts = [
43
        'rate' => 'float',
44
    ];
45
46
    public function source(): BelongsTo
47
    {
48
        return $this->belongsTo(Currency::class, 'source_currency_id');
49
    }
50
51
    public function target(): BelongsTo
52
    {
53
        return $this->belongsTo(Currency::class, 'target_currency_id');
54
    }
55
}
56