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

LeagueRound   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 1 Features 2
Metric Value
wmc 3
c 2
b 1
f 2
lcom 0
cbo 1
dl 0
loc 54
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A league() 0 4 1
A matches() 0 4 1
A scopeComplete() 0 9 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
}