Auction   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 49
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A scopeUnpaid() 0 3 1
A scopePaid() 0 3 1
A session() 0 3 1
A remitment() 0 3 1
1
<?php
2
3
namespace Siak\Tontine\Model;
4
5
use Illuminate\Database\Eloquent\Builder;
6
7
/**
8
 * @property int $amount
9
 * @property bool $paid
10
 * @property-read Remitment $remitment
11
 * @property-read Session $session
12
 * @method static Builder paid()
13
 * @method static Builder unpaid()
14
 */
15
class Auction extends Base
16
{
17
    /**
18
     * Indicates if the model should be timestamped.
19
     *
20
     * @var bool
21
     */
22
    public $timestamps = false;
23
24
    /**
25
     * The attributes that are mass assignable.
26
     *
27
     * @var array
28
     */
29
    protected $fillable = [
30
        'amount',
31
        'paid',
32
        'session_id',
33
        'remitment_id',
34
    ];
35
36
    public function remitment()
37
    {
38
        return $this->belongsTo(Remitment::class);
39
    }
40
41
    public function session()
42
    {
43
        return $this->belongsTo(Session::class);
44
    }
45
46
    /**
47
     * @param  Builder  $query
48
     *
49
     * @return Builder
50
     */
51
    public function scopePaid(Builder $query): Builder
52
    {
53
        return $query->where('paid', true);
54
    }
55
56
    /**
57
     * @param  Builder  $query
58
     *
59
     * @return Builder
60
     */
61
    public function scopeUnpaid(Builder $query): Builder
62
    {
63
        return $query->where('paid', false);
64
    }
65
}
66