SessionBill::scopePaid()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Siak\Tontine\Model;
4
5
use Illuminate\Database\Eloquent\Builder;
6
7
class SessionBill extends Base
8
{
9
    /**
10
     * Indicates if the model should be timestamped.
11
     *
12
     * @var bool
13
     */
14
    public $timestamps = false;
15
16
    public function session()
17
    {
18
        return $this->belongsTo(Session::class);
19
    }
20
21
    public function charge()
22
    {
23
        return $this->belongsTo(Charge::class);
24
    }
25
26
    public function member()
27
    {
28
        return $this->belongsTo(Member::class);
29
    }
30
31
    public function bill()
32
    {
33
        return $this->belongsTo(Bill::class);
34
    }
35
36
    /**
37
     * @param  Builder  $query
38
     *
39
     * @return Builder
40
     */
41
    public function scopePaid(Builder $query): Builder
42
    {
43
        return $query->whereHas('bill', fn(Builder $billQuery) => $billQuery->paid());
0 ignored issues
show
Bug Best Practice introduced by
The expression return $query->whereHas(...ion(...) { /* ... */ }) 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...
44
    }
45
}
46