|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Gameap\Models; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Database\Eloquent\Model; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Class Game |
|
9
|
|
|
* @package Gameap\Models |
|
10
|
|
|
* |
|
11
|
|
|
* @property string $code |
|
12
|
|
|
* @property string $name |
|
13
|
|
|
* @property string $engine |
|
14
|
|
|
* @property string $engine_version |
|
15
|
|
|
* @property integer $steam_app_id_linux |
|
16
|
|
|
* @property integer $steam_app_id_windows |
|
17
|
|
|
* @property string $steam_app_set_config |
|
18
|
|
|
* @property string $remote_repository_linux |
|
19
|
|
|
* @property string $remote_repository_windows |
|
20
|
|
|
* @property string $local_repository_linux |
|
21
|
|
|
* @property string $local_repository_windows |
|
22
|
|
|
*/ |
|
23
|
|
|
class Game extends Model |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* @var bool |
|
27
|
|
|
*/ |
|
28
|
|
|
public $timestamps = false; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Indicates if the IDs are auto-incrementing. |
|
32
|
|
|
* |
|
33
|
|
|
* @var bool |
|
34
|
|
|
*/ |
|
35
|
|
|
public $incrementing = false; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* The primary key for the model. |
|
39
|
|
|
* |
|
40
|
|
|
* @var string |
|
41
|
|
|
*/ |
|
42
|
|
|
protected $primaryKey = 'code'; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* The "type" of the auto-incrementing ID. |
|
46
|
|
|
* |
|
47
|
|
|
* @var string |
|
48
|
|
|
*/ |
|
49
|
|
|
protected $keyType = 'string'; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* The attributes that are mass assignable. |
|
53
|
|
|
* |
|
54
|
|
|
* @var array |
|
55
|
|
|
*/ |
|
56
|
|
|
protected $fillable = [ |
|
57
|
|
|
'code', 'name', |
|
58
|
|
|
'engine', 'engine_version', |
|
59
|
|
|
'steam_app_id_linux', 'steam_app_id_windows', |
|
60
|
|
|
'steam_app_set_config', |
|
61
|
|
|
'remote_repository_linux', 'remote_repository_windows', |
|
62
|
|
|
'local_repository_linux', 'local_repository_windows' |
|
63
|
|
|
]; |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
3 |
|
* One to many relation |
|
67
|
|
|
* |
|
68
|
3 |
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany |
|
69
|
|
|
*/ |
|
70
|
|
|
public function servers() |
|
71
|
|
|
{ |
|
72
|
|
|
return $this->hasMany(Server::class, 'game_id'); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
3 |
|
* One to many relation |
|
77
|
|
|
* |
|
78
|
3 |
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany |
|
79
|
|
|
*/ |
|
80
|
|
|
public function mods() |
|
81
|
|
|
{ |
|
82
|
|
|
return $this->hasMany(GameMod::class); |
|
83
|
|
|
} |
|
84
|
|
|
} |
|
85
|
|
|
|