MatchPlayer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A player() 0 4 1
A team() 0 4 1
A scopeComplete() 0 6 1
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
    protected $casts = [
29
        'vote' => 'integer',
30
        'goals' => 'integer'
31
    ];
32
33
    /**
34
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
35
     */
36
    public function player()
37
    {
38
        return $this->belongsTo(Player::class, 'player_id');
39
    }
40
41
    /**
42
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
43
     */
44
    public function team()
45
    {
46
        return $this->belongsTo(Team::class, 'team_id');
47
    }
48
49
    /**
50
     * @param $query
51
     * @return mixed
52
     */
53
    public function scopeComplete($query){
54
        return $query->with(
55
            'team',
56
            'player'
57
        );
58
    }
59
60
}