Refund   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A amount() 0 5 1
A debt() 0 3 1
A session() 0 3 1
1
<?php
2
3
namespace Siak\Tontine\Model;
4
5
use Illuminate\Database\Eloquent\Casts\Attribute;
6
use Siak\Tontine\Service\Meeting\Credit\DebtCalculator;
7
8
use function app;
9
10
class Refund extends Base
11
{
12
    /**
13
     * Indicates if the model should be timestamped.
14
     *
15
     * @var bool
16
     */
17
    public $timestamps = false;
18
19
    public function session()
20
    {
21
        return $this->belongsTo(Session::class);
22
    }
23
24
    public function debt()
25
    {
26
        return $this->belongsTo(Debt::class);
27
    }
28
29
    /**
30
     * @return Attribute
31
     */
32
    protected function amount(): Attribute
33
    {
34
        return Attribute::make(
35
            get: fn() => app()->make(DebtCalculator::class)
36
                ->getDebtDueAmount($this->debt, $this->session, false),
37
        );
38
    }
39
}
40