Completed
Push — master ( 5e9888...3ffa02 )
by Vincenzo
02:34
created

LeagueRound::scopeComplete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 1
Metric Value
c 1
b 1
f 1
dl 0
loc 9
rs 9.6666
cc 1
eloc 6
nc 1
nop 1
1
<?php
2
3
namespace App\Lib\DsManager\Models\Orm;
4
5
/**
6
 * Class LeagueRound
7
 * @package App\Lib\DsManager\Models\Orm
8
 */
9
class LeagueRound extends DsManagerOrm
10
{
11
12
    /**
13
     * @var string
14
     */
15
    protected $table = 'league_rounds';
16
17
    /**
18
     * @var array
19
     */
20
    protected $fillable = [
21
        'league_id',
22
        'day',
23
        'simulated'
24
    ];
25
26
    /**
27
     * @var array
28
     */
29
    protected $casts = [
30
        'simulated' => 'boolean'
31
    ];
32
33
    /**
34
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
35
     */
36
    public function league()
37
    {
38
        return $this->belongsTo(League::class);
39
    }
40
41
    /**
42
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
43
     */
44
    public function matches()
45
    {
46
        return $this->hasMany(Match::class);
47
    }
48
49
    /**
50
     * @param $query
51
     * @return mixed
52
     */
53
    public function scopeComplete($query)
54
    {
55
        return $query->with(
56
            'league',
57
            'matches',
58
            'matches.homeTeam',
59
            'matches.AwayTeam'
60
        );
61
    }
62
}