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

Team::competitors()   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 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