Member::teamMembers()   A
last analyzed

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
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace App;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Contracts\Auth\Authenticatable;
7
8
class Member extends Model implements Authenticatable
9
{
10
    use \Illuminate\Auth\Authenticatable;
11
12
    /**
13
     * The database table used by the model.
14
     *
15
     * @var string
16
     */
17
    protected $table = 'members';
18
19
    /**
20
     * The attributes that are mass assignable.
21
     *
22
     * @var array
23
     */
24
    protected $fillable = ['name', 'facebookId'];
25
26
    /**
27
     * The attributes excluded from the model's JSON form.
28
     *
29
     * @var array
30
     */
31
    protected $hidden = [];
32
33
    /**
34
     * @var bool
35
     */
36
    public $timestamps = true;
37
38
    /**
39
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
40
     */
41
    public function teamMembers()
42
    {
43
        return $this->hasMany(TeamMember::class, 'memberId');
44
    }
45
46
    /**
47
     * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
48
     */
49
    public function tournamentTeams()
50
    {
51
        return $this->hasManyThrough(
52
            TournamentTeam::class,
53
            TeamMember::class,
54
            'memberId',
55
            'id'
56
        );
57
    }
58
59
    /**
60
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
61
     */
62
    public function tokens()
63
    {
64
        return $this->hasMany('MemberToken');
65
    }
66
67
    /**
68
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
69
     */
70
    public function tournaments()
71
    {
72
        return $this->hasMany(Tournament::class, 'owner');
73
    }
74
}
75