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

PlayerGame   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 5
c 0
b 0
f 0
dl 0
loc 18
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getPlayers() 0 3 1
A findByPlayerGame() 0 3 1
A player() 0 3 1
1
<?php
2
3
namespace Furic\GameEssentials\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class PlayerGame extends Model
8
{
9
10
    protected $fillable = ['player_id', 'game_id', 'is_online', 'channel', 'version', 'is_hack'];
11
12
    public function player()
13
    {
14
        return $this->belongsTo('App\Player');
15
    }
16
17
    public static function findByPlayerGame($playerId, $gameId)
18
    {
19
        return SELF::where('player_id', $playerId)->where('game_id', $gameId)->first();
20
    }
21
    
22
    public static function getPlayers($gameId)
23
    {
24
        return SELF::where('game_id', $gameId);
25
    }
26
}
27