Match::setDateAttribute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 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