1 | <?php |
||
33 | class Server extends Model |
||
34 | { |
||
35 | use Notifiable, SoftDeletes; |
||
36 | |||
37 | /** |
||
38 | * The table associated with the model. |
||
39 | * |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $table = 'servers'; |
||
43 | |||
44 | /** |
||
45 | * The attributes excluded from the model's JSON form. |
||
46 | * |
||
47 | * @var array |
||
48 | */ |
||
49 | protected $hidden = ['daemonSecret', 'sftp_password']; |
||
50 | |||
51 | /** |
||
52 | * The attributes that should be mutated to dates. |
||
53 | * |
||
54 | * @var array |
||
55 | */ |
||
56 | protected $dates = ['deleted_at']; |
||
57 | |||
58 | /** |
||
59 | * Fields that are not mass assignable. |
||
60 | * |
||
61 | * @var array |
||
62 | */ |
||
63 | protected $guarded = ['id', 'installed', 'created_at', 'updated_at', 'deleted_at']; |
||
64 | |||
65 | /** |
||
66 | * Cast values to correct type. |
||
67 | * |
||
68 | * @var array |
||
69 | */ |
||
70 | protected $casts = [ |
||
71 | 'node_id' => 'integer', |
||
72 | 'suspended' => 'integer', |
||
73 | 'owner_id' => 'integer', |
||
74 | 'memory' => 'integer', |
||
75 | 'swap' => 'integer', |
||
76 | 'disk' => 'integer', |
||
77 | 'io' => 'integer', |
||
78 | 'cpu' => 'integer', |
||
79 | 'oom_disabled' => 'integer', |
||
80 | 'allocation_id' => 'integer', |
||
81 | 'service_id' => 'integer', |
||
82 | 'option_id' => 'integer', |
||
83 | 'pack_id' => 'integer', |
||
84 | 'installed' => 'integer', |
||
85 | ]; |
||
86 | |||
87 | /** |
||
88 | * @var array |
||
89 | */ |
||
90 | protected static $serverUUIDInstance = []; |
||
91 | |||
92 | /** |
||
93 | * @var mixed |
||
94 | */ |
||
95 | protected static $user; |
||
96 | |||
97 | /** |
||
98 | * Constructor. |
||
99 | */ |
||
100 | public function __construct() |
||
105 | |||
106 | /** |
||
107 | * Returns array of all servers owned by the logged in user. |
||
108 | * Returns all users servers if user is a root admin. |
||
109 | * |
||
110 | * @return \Illuminate\Database\Eloquent\Collection |
||
111 | */ |
||
112 | public static function getUserServers($paginate = null) |
||
139 | |||
140 | /** |
||
141 | * Returns a single server specified by UUID. |
||
142 | * DO NOT USE THIS TO MODIFY SERVER DETAILS OR SAVE THOSE DETAILS. |
||
143 | * YOU WILL OVERWRITE THE SECRET KEY AND BREAK THINGS. |
||
144 | * |
||
145 | * @param string $uuid The Short-UUID of the server to return an object about. |
||
146 | * @return \Illuminate\Database\Eloquent\Collection |
||
147 | */ |
||
148 | public static function byUuid($uuid) |
||
164 | |||
165 | /** |
||
166 | * Returns non-administrative headers for accessing a server on the daemon. |
||
167 | * |
||
168 | * @param string $uuid |
||
169 | * @return array |
||
170 | */ |
||
171 | public function guzzleHeaders() |
||
178 | |||
179 | /** |
||
180 | * Return an instance of the Guzzle client for this specific server using defined access token. |
||
181 | * |
||
182 | * @return \GuzzleHttp\Client |
||
183 | */ |
||
184 | public function guzzleClient() |
||
188 | |||
189 | /** |
||
190 | * Returns javascript object to be embedded on server view pages with relevant information. |
||
191 | * |
||
192 | * @return \Laracasts\Utilities\JavaScript\JavaScriptFacade |
||
193 | */ |
||
194 | public function js($additional = null, $overwrite = null) |
||
220 | |||
221 | /** |
||
222 | * Gets all allocations associated with this server. |
||
223 | * |
||
224 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
225 | */ |
||
226 | public function allocations() |
||
230 | |||
231 | /** |
||
232 | * Gets information for the pack associated with this server. |
||
233 | * |
||
234 | * @return \Illuminate\Database\Eloquent\Relations\HasOne |
||
235 | */ |
||
236 | public function pack() |
||
240 | |||
241 | /** |
||
242 | * Gets information for the service associated with this server. |
||
243 | * |
||
244 | * @return \Illuminate\Database\Eloquent\Relations\HasOne |
||
245 | */ |
||
246 | public function service() |
||
250 | |||
251 | /** |
||
252 | * Gets information for the service option associated with this server. |
||
253 | * |
||
254 | * @return \Illuminate\Database\Eloquent\Relations\HasOne |
||
255 | */ |
||
256 | public function option() |
||
260 | |||
261 | /** |
||
262 | * Gets information for the service variables associated with this server. |
||
263 | * |
||
264 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
265 | */ |
||
266 | public function variables() |
||
270 | |||
271 | /** |
||
272 | * Gets information for the node associated with this server. |
||
273 | * |
||
274 | * @return \Illuminate\Database\Eloquent\Relations\HasOne |
||
275 | */ |
||
276 | public function node() |
||
280 | |||
281 | /** |
||
282 | * Gets information for the tasks associated with this server. |
||
283 | * |
||
284 | * @TODO adjust server column in tasks to be server_id |
||
285 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
286 | */ |
||
287 | public function tasks() |
||
291 | } |
||
292 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: