Match   A
last analyzed

Complexity

Total Complexity 11

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 11
lcom 0
cbo 0
dl 0
loc 60
rs 10
c 0
b 0
f 0

11 Methods

Rating   Name   Duplication   Size   Complexity  
A course() 0 4 1
A season() 0 4 1
A winners() 0 4 1
A money() 0 4 1
A skins() 0 4 1
A players() 0 4 1
A getAllMatches() 0 5 1
A setDateAttribute() 0 4 1
A playersEdit() 0 4 1
A rounds() 0 4 1
A holes() 0 4 1
1
<?php
2
3
class Match extends Eloquent
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
{
5
	protected $table = 'matches';
6
7
	public function setDateAttribute($date)
8
    {
9
		$this->attributes['date'] = date('Y-m-d', strtotime(str_replace('-', '/', $date)));
10
    }
11
12
	public function course()
13
    {
14
        return $this->belongsTo('Course');
15
    }
16
17
	public function season()
18
    {
19
        return $this->belongsTo('Season');
20
    }
21
22
	public function winners()
23
    {
24
        return $this->hasMany('Winner');
25
    }
26
27
	public function money()
28
    {
29
        return $this->hasMany('Money');
30
    }
31
32
	public function skins()
33
    {
34
        return $this->hasMany('Skin');
35
    }
36
37
	public function players()
38
    {
39
        return $this->belongsToMany('Player')->withPivot('level_id', 'group', 'handicap', 'winnings')->orderBy('pivot_winnings', 'desc')->withTimestamps();
40
    }
41
42
    public function playersEdit()
43
    {
44
        return $this->belongsToMany('Player')->withPivot('level_id', 'group', 'handicap', 'winnings')->orderBy('pivot_group', 'asc')->withTimestamps();
45
    }
46
47
	public function rounds()
48
	{
49
		return $this->hasMany('Round');
50
	}
51
52
	public function holes()
53
	{
54
        return $this->hasManyThrough('Hole', 'Course');
55
    }
56
57
	public function getAllMatches()
58
	{
59
		$matches = DB::table('matches')->get();
60
		return $matches;
61
	}
62
}
63