Player   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
eloc 9
c 1
b 0
f 0
dl 0
loc 35
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
    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
}