Receivable   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 42
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A session() 0 3 1
A subscription() 0 3 1
A deposit() 0 3 1
A scopePaid() 0 3 1
1
<?php
2
3
namespace Siak\Tontine\Model;
4
5
use Illuminate\Database\Eloquent\Builder;
6
7
class Receivable extends Base
8
{
9
    /**
10
     * Indicates if the model should be timestamped.
11
     *
12
     * @var bool
13
     */
14
    public $timestamps = false;
15
16
    /**
17
     * The attributes that are mass assignable.
18
     *
19
     * @var array
20
     */
21
    protected $fillable = [
22
        'notes',
23
        'session_id',
24
    ];
25
26
    public function session()
27
    {
28
        return $this->belongsTo(Session::class);
29
    }
30
31
    public function subscription()
32
    {
33
        return $this->belongsTo(Subscription::class);
34
    }
35
36
    public function deposit()
37
    {
38
        return $this->hasOne(Deposit::class);
39
    }
40
41
    /**
42
     * @param  Builder  $query
43
     *
44
     * @return Builder
45
     */
46
    public function scopePaid(Builder $query): Builder
47
    {
48
        return $query->whereHas('deposit');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $query->whereHas('deposit') could return the type Illuminate\Database\Query\Builder which is incompatible with the type-hinted return Illuminate\Database\Eloquent\Builder. Consider adding an additional type-check to rule them out.
Loading history...
49
    }
50
}
51