Code Duplication    Length = 42-44 lines in 2 locations

app/TeamMember.php 1 location

@@ 12-55 (lines=44) @@
9
 * Class TeamMember
10
 * @package App
11
 */
12
class TeamMember extends Model
13
{
14
15
    /**
16
     * @var string
17
     */
18
    protected $table = 'team_members';
19
20
    /**
21
     * @var array
22
     */
23
    protected $fillable = ['memberId', 'tournamentTeamId'];
24
25
    /**
26
     * !!! Looks like an ugly workaround !!!
27
     *
28
     * @return string
29
     */
30
    public function getKeyName()
31
    {
32
        return 'tournamentTeamId';
33
    }
34
35
    /**
36
     * @var bool
37
     */
38
    public $timestamps = false;
39
40
    /**
41
     * @return Eloquent\Relations\BelongsTo
42
     */
43
    public function member()
44
    {
45
        return $this->belongsTo(Member::class, 'memberId');
46
    }
47
48
    /**
49
     * @return Eloquent\Relations\BelongsTo
50
     */
51
    public function tournamentTeam()
52
    {
53
        return $this->belongsTo(TournamentTeam::class, 'tournamentTeamId');
54
    }
55
}
56

app/TournamentTeam.php 1 location

@@ 11-52 (lines=42) @@
8
 * Class TournamentTeam
9
 * @package App
10
 */
11
class TournamentTeam extends Model
12
{
13
14
    /**
15
     * @var string
16
     */
17
    protected $table = 'tournament_teams';
18
19
    /**
20
     * @var array
21
     */
22
    protected $fillable = ['tournamentId', 'teamId'];
23
24
    /**
25
     * @var bool
26
     */
27
    public $timestamps = false;
28
29
    /**
30
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
31
     */
32
    public function tournament()
33
    {
34
        return $this->belongsTo(Tournament::class, 'tournamentId');
35
    }
36
37
    /**
38
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
39
     */
40
    public function team()
41
    {
42
        return $this->belongsTo(Team::class, 'teamId');
43
    }
44
45
    /**
46
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
47
     */
48
    public function teamMembers()
49
    {
50
        return $this->hasMany(TeamMember::class, 'tournamentTeamId', 'teamId');
51
    }
52
}
53