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

Player::games()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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