Test Failed
Push — master ( 471081...703a37 )
by Julien
03:32 queued 32s
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
use Illuminate\Database\Eloquent\Model;
6
7
class Team extends Model
8
{
9
    protected $table = 'team';
10
    public $timestamps = true;
11
    protected $fillable = ['name', 'championship_id'];
12
13
    /**
14
     * A Team belongs to a Championship.
15
     *
16
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
17
     */
18
    public function championship()
19
    {
20
        return $this->belongsTo(Championship::class);
21
    }
22
23
    /**
24
     * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
25
     */
26
    public function category()
27
    {
28
        return $this->hasManyThrough(Category::class, Championship::class);
29
    }
30
31
    public function fightersGroups()
32
    {
33
        return $this->belongsToMany(FightersGroup::class, 'round_team')->withTimestamps();
34
    }
35
36
    public function competitors()
37
    {
38
        return $this->belongsToMany(Competitor::class);
39
    }
40
}
41