forked from MsotoM/PanelIPTV
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_models.php
More file actions
104 lines (69 loc) · 2.16 KB
/
_models.php
File metadata and controls
104 lines (69 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
class User extends Illuminate\Database\Eloquent\Model {
protected $table = 'users';
public function categories() {
return $this->belongsToMany('Category');
}
public function getCategoryNamesAttribute() {
$return = "";
$prefix = '';
foreach ($this->categories as $category) {
$return .= $prefix . ' ' . $category->name . '';
$prefix = ', ';
}
return $return;
}
public function activity() {
return $this->hasMany('Activity');
}
public function laststream() {
return $this->hasOne('Stream', 'id', 'last_stream');
}
}
class Stream extends Illuminate\Database\Eloquent\Model {
public function category() {
return $this->hasOne('Category', 'id', 'cat_id');
}
public function transcode() {
return $this->hasOne('Transcode', 'id', 'trans_id');
}
public function getStatusLabelAttribute() {
$return = [];
$return['label'] = 'danger';
$return['text'] = 'STOPPED';
if ($this->status == '1') {
$return['label'] = 'success';
$return['text'] = 'RUNNING';
} else if ($this->status == '2') {
$return['label'] = 'danger';
$return['text'] = 'ERROR';
}
return $return;
}
}
class Category extends Illuminate\Database\Eloquent\Model {
public function streams() {
return $this->hasMany('Stream', 'cat_id', 'id');
}
}
class Admin extends Illuminate\Database\Eloquent\Model {
}
class Setting extends Illuminate\Database\Eloquent\Model {
}
class Transcode extends Illuminate\Database\Eloquent\Model {
}
class BlockedIp extends Illuminate\Database\Eloquent\Model {
protected $table = 'blocked_ips';
}
class BlockedUseragent extends Illuminate\Database\Eloquent\Model {
protected $table = 'blocked_user_agents';
}
class Activity extends Illuminate\Database\Eloquent\Model {
protected $table = 'activity';
public function user() {
return $this->hasOne('user', 'id', 'user_id');
}
public function stream() {
return $this->hasOne('stream', 'id', 'stream_id');
}
}