Player::findByPlayGamesId()   A
last analyzed

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 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
    protected $hidden = ['created_at', 'updated_at'];
13
14
    public function games()
15
    {
16
        return $this->belongsToMany(Game::class);
17
    }
18
19
    public static function findByName($nameId)
20
    {
21
        return SELF::where('name', $nameId)->first();
22
    }
23
    
24
    public static function findByFacebookId($fbId)
25
    {
26
        return SELF::where('facebook_id', $fbId)->first();
27
    }
28
29
    public static function findByGameCenterId($gcId)
30
    {
31
        return SELF::where('gamecenter_id', $gcId)->first();
32
    }
33
34
    public static function findByPlayGamesId($pgId)
35
    {
36
        return SELF::where('playgames_id', $pgId)->first();
37
    }
38
39
    public static function findByUdid($udid)
40
    {
41
        return SELF::where('udid', $udid)->first();
42
    }
43
44
}