Completed
Push — master ( 8c4be0...39f1f0 )
by Orkhan
01:13
created

Payment::getFormattedAmountAttribute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Orkhanahmadov\LaravelGoldenpay\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Orkhanahmadov\Goldenpay\Enums\Language;
7
8
/**
9
 * Class Payment
10
 * @package Orkhanahmadov\LaravelGoldenpay\Models
11
 *
12
 * @property int $id
13
 * @property string $payment_key
14
 * @property int $amount
15
 * @property string $card_type
16
 * @property string $language
17
 * @property string $description
18
 * @property int $status
19
 * @property string $message
20
 * @property string $reference_number
21
 * @property string $card_number
22
 * @property \Carbon\Carbon $payment_date
23
 * @property int $checks
24
 * @property \Carbon\Carbon $created_at
25
 * @property \Carbon\Carbon $updated_at
26
 * @property-read float|int $formatted_amount
27
 * @method static Payment first()
28
 */
29
class Payment extends Model
30
{
31
    protected $guarded = [];
32
33
    protected $dates = [
34
        'payment_date',
35
    ];
36
37
    protected $hidden = [
38
        'card_number',
39
    ];
40
41
    protected $casts = [
42
        'amount' => 'int',
43
        'status' => 'int',
44
    ];
45
46
    public function __construct(array $attributes = [])
47
    {
48
        parent::__construct($attributes);
49
50
        $this->setTable(config('goldenpay.table_name'));
51
    }
52
53
    public function getFormattedAmountAttribute()
54
    {
55
        return $this->amount / 100;
56
    }
57
}
58