Test Failed
Push — master ( b6687a...d5e75a )
by Julien
06:32
created

Category::isForWomen()   A

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 0
1
<?php
2
3
namespace Xoco70\LaravelTournaments\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
/**
8
 * @property mixed team
9
 * @property mixed gender
10
 * @property mixed ageCategory
11
 * @property mixed ageMin
12
 * @property mixed ageMax
13
 * @property mixed gradeMin
14
 * @property mixed gradeMax
15
 * @property mixed isTeam
16
 */
17
class Category extends Model
18
{
19
    protected $table = 'category';
20
    public $timestamps = true;
21
22
    protected $fillable = [
23
        'id',
24
        'name',
25
        'gender',
26
        'isTeam',
27
        'ageCategory',
28
        'ageMin',
29
        'ageMax',
30
        'gradeCategory',
31
        'gradeMin',
32
        'gradeMax',
33
    ];
34
35
36
    public function getNameAttribute($name)
37
    {
38
39
        return trans($name);
40
    }
41
42
    public function getGradeAttribute($grade)
43
    {
44
        return trans($grade);
45
    }
46
47
    public function getAgeCategoryAttribute($ageCategory)
48
    {
49
        return trans($ageCategory);
50
    }
51
52
    public function tournaments()
53
    {
54
        return $this->belongsToMany('App\Tournament');
55
    }
56
57
    public function championship()
58
    {
59
        return $this->hasMany(Championship::class);
60
    }
61
62
    public function isTeam()
63
    {
64
        return $this->isTeam;
65
    }
66
67
    public function isForMen()
68
    {
69
        return $this->gender == 'M';
70
    }
71
72
    public function isForWomen()
73
    {
74
        return $this->gender == 'F';
75
    }
76
77
    public function isMixt()
78
    {
79
        return $this->gender == 'X';
80
    }
81
}
82