Passed
Push — main ( b96c2d...30a05e )
by Richard
04:40
created

Player   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 8
c 0
b 0
f 0
dl 0
loc 33
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A findByFacebookId() 0 3 1
A findByGameCenterId() 0 3 1
A findByName() 0 3 1
A findByPlayGamesId() 0 3 1
A findByUdid() 0 3 1
A games() 0 3 1
1
<?php
2
3
namespace Furic\GameEssentials\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class Player extends Model
8
{
9
10
    protected $fillable = ['facebook_id', 'gamecenter_id', 'playgames_id', 'udid', 'name', 'ip'];
11
12
    public function games()
13
    {
14
        return $this->hasMany('App\PlayerGame');
15
    }
16
17
    public static function findByName($nameId)
18
    {
19
        return SELF::where('name', $nameId)->first();
20
    }
21
    
22
    public static function findByFacebookId($fbId)
23
    {
24
        return SELF::where('facebook_id', $fbId)->first();
25
    }
26
27
    public static function findByGameCenterId($gcId)
28
    {
29
        return SELF::where('gamecenter_id', $gcId)->first();
30
    }
31
32
    public static function findByPlayGamesId($pgId)
33
    {
34
        return SELF::where('playgames_id', $pgId)->first();
35
    }
36
37
    public static function findByUdid($udid)
38
    {
39
        return SELF::where('udid', $udid)->first();
40
    }
41
}
42