Passed
Push — master ( 1d6548...c98942 )
by Julien
29:57
created

Team   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 5
Bugs 0 Features 1
Metric Value
wmc 4
c 5
b 0
f 1
lcom 0
cbo 2
dl 0
loc 31
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A fightersGroups() 0 4 1
A competitors() 0 4 1
A getName() 0 4 2
1
<?php
2
3
namespace Xoco70\KendoTournaments\Models;
4
5
class Team extends Fighter
6
{
7
    protected $table = 'team';
8
    public $timestamps = true;
9
    protected $fillable = ['short_id', 'name', 'championship_id'];
10
11
12
13
    /**
14
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
15
     */
16
    public function fightersGroups()
17
    {
18
        return $this->belongsToMany(FightersGroup::class, 'fighters_group_team')->withTimestamps();
19
    }
20
21
    public function competitors()
22
    {
23
        return $this->belongsToMany(Competitor::class)->withTimestamps();
24
    }
25
26
    /**
27
     * Get Team Name
28
     * @return mixed|string
29
     */
30
    public function getName()
31
    {
32
        return $this == null ? "BYE" : $this->name;
33
    }
34
35
}
36