RoleTrait::isSuperAdmin()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
namespace App\Traits;
4
5
trait RoleTrait
6
{
7
    /**
8
     * @return bool
9
     */
10 34
    public function isSuperAdmin()
11
    {
12 34
        return $this->role_id == config('constants.ROLE_SUPERADMIN');
13
    }
14
15
    /**
16
     * @return bool
17
     */
18 29
    public function isFederationPresident()
19
    {
20 29
        return $this->role_id == config('constants.ROLE_FEDERATION_PRESIDENT');
21
    }
22
23
    /**
24
     * @return bool
25
     */
26 29
    public function isAssociationPresident()
27
    {
28 29
        return $this->role_id == config('constants.ROLE_ASSOCIATION_PRESIDENT');
29
    }
30
31
    /**
32
     * @return bool
33
     */
34 28
    public function isClubPresident()
35
    {
36 28
        return $this->role_id == config('constants.ROLE_CLUB_PRESIDENT');
37
    }
38
39
    /**
40
     * @return bool
41
     */
42
    public function isUser()
43
    {
44
        return $this->role_id == config('constants.ROLE_USER');
45
    }
46
47
    /**
48
     * @return bool
49
     */
50 5
    public function isUserOrMore()
51
    {
52 5
        return $this->role_id <= config('constants.ROLE_USER');
53
    }
54
55
    /**
56
     * @param $tournament
57
     * @return bool
58
     */
59
    public function isOwner($tournament)
60
    {
61
        return $tournament->user_id == $this->id;
62
    }
63
}