Completed
Push — master ( 48f19c...ace4de )
by Vincenzo
03:02
created

MatchPlayer::team()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace App\Lib\DsManager\Models\Orm;
4
5
/**
6
 * Class MatchPlayer
7
 * @package App\Lib\DsManager\Models\Orm
8
 */
9
class MatchPlayer extends DsManagerOrm
10
{
11
12
    /**
13
     * @var string
14
     */
15
    protected $table = 'match_players';
16
17
    /**
18
     * @var array
19
     */
20
    protected $fillable = [
21
        'match_id',
22
        'team_id',
23
        'player_id',
24
        'goals',
25
        'vote'
26
    ];
27
28
    /**
29
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
30
     */
31
    public function player()
32
    {
33
        return $this->belongsTo(Player::class, 'player_id');
34
    }
35
36
    /**
37
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
38
     */
39
    public function team()
40
    {
41
        return $this->belongsTo(Team::class, 'team_id');
42
    }
43
44
    /**
45
     * @param $query
46
     * @return mixed
47
     */
48
    public function scopeComplete($query){
49
        return $query->with(
50
            'team',
51
            'player'
52
        );
53
    }
54
55
}