-
-
Notifications
You must be signed in to change notification settings - Fork 364
/
BonExchange.php
110 lines (99 loc) · 2.25 KB
/
BonExchange.php
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
105
106
107
108
109
110
<?php
/**
* NOTICE OF LICENSE
*
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D
* @license https://choosealicense.com/licenses/gpl-3.0/ GNU General Public License v3.0
* @author Mr.G
*/
namespace App;
use App\User;
use Illuminate\Database\Eloquent\Model;
class BonExchange extends Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'bon_exchange';
/**
* Tells Laravel to not maintain the timestamp columns
*
* @var boolean
*/
public $timestamps = false;
/**
* The attributes that should be casted to native types.
*
* @var array
*/
protected $casts = [
'upload' => 'boolean',
'download' => 'boolean',
'personal_freeleech' => 'boolean',
'invite' => 'boolean',
];
/**
* @method getDownloadOptions
*
* @return array[][]
*/
public function getDownloadOptions()
{
return BonExchange::where('download', true)
->orderBy('value', 'asc')
->get()
->toArray();
}
/**
* @method getUploadOptions
*
* @return array[][]
*/
public function getUploadOptions()
{
return BonExchange::where('upload', true)
->orderBy('value', 'asc')
->get()
->toArray();
}
/**
* @method getPersonalFreeleechOption
*
* @return array[][]
*/
public function getPersonalFreeleechOption()
{
return BonExchange::where('personal_freeleech', true)
->orderBy('value', 'asc')
->get()
->toArray();
}
/**
* @method getInviteOption
*
* @return array[][]
*/
public function getInviteOption()
{
return BonExchange::where('invite', true)
->orderBy('value', 'asc')
->get()
->toArray();
}
/**
* @method getItemCost
*
* @return integer
*/
public function getItemCost($id)
{
return BonExchange::where('id', '=', $id)
->get()
->toArray()[0]['cost'];
}
}