1 | <?php |
||
32 | class Server extends Model |
||
33 | { |
||
34 | use Notifiable, SoftDeletes; |
||
35 | |||
36 | /** |
||
37 | * The table associated with the model. |
||
38 | * |
||
39 | * @var string |
||
40 | */ |
||
41 | protected $table = 'servers'; |
||
42 | |||
43 | /** |
||
44 | * The attributes excluded from the model's JSON form. |
||
45 | * |
||
46 | * @var array |
||
47 | */ |
||
48 | protected $hidden = ['daemonSecret', 'sftp_password']; |
||
49 | |||
50 | /** |
||
51 | * The attributes that should be mutated to dates. |
||
52 | * |
||
53 | * @var array |
||
54 | */ |
||
55 | protected $dates = ['deleted_at']; |
||
56 | |||
57 | /** |
||
58 | * Fields that are not mass assignable. |
||
59 | * |
||
60 | * @var array |
||
61 | */ |
||
62 | protected $guarded = ['id', 'installed', 'created_at', 'updated_at', 'deleted_at']; |
||
63 | |||
64 | /** |
||
65 | * Cast values to correct type. |
||
66 | * |
||
67 | * @var array |
||
68 | */ |
||
69 | protected $casts = [ |
||
70 | 'node' => 'integer', |
||
71 | 'suspended' => 'integer', |
||
72 | 'owner' => 'integer', |
||
73 | 'memory' => 'integer', |
||
74 | 'swap' => 'integer', |
||
75 | 'disk' => 'integer', |
||
76 | 'io' => 'integer', |
||
77 | 'cpu' => 'integer', |
||
78 | 'oom_disabled' => 'integer', |
||
79 | 'port' => 'integer', |
||
80 | 'service' => 'integer', |
||
81 | 'option' => 'integer', |
||
82 | 'installed' => 'integer', |
||
83 | ]; |
||
84 | |||
85 | /** |
||
86 | * @var array |
||
87 | */ |
||
88 | protected static $serverUUIDInstance = []; |
||
89 | |||
90 | /** |
||
91 | * @var mixed |
||
92 | */ |
||
93 | protected static $user; |
||
94 | |||
95 | /** |
||
96 | * Constructor. |
||
97 | */ |
||
98 | public function __construct() |
||
103 | |||
104 | /** |
||
105 | * Returns array of all servers owned by the logged in user. |
||
106 | * Returns all users servers if user is a root admin. |
||
107 | * |
||
108 | * @return \Illuminate\Database\Eloquent\Collection |
||
109 | */ |
||
110 | public static function getUserServers($paginate = null) |
||
137 | |||
138 | /** |
||
139 | * Returns a single server specified by UUID. |
||
140 | * DO NOT USE THIS TO MODIFY SERVER DETAILS OR SAVE THOSE DETAILS. |
||
141 | * YOU WILL OVERWRITE THE SECRET KEY AND BREAK THINGS. |
||
142 | * |
||
143 | * @param string $uuid The Short-UUID of the server to return an object about. |
||
144 | * @return \Illuminate\Database\Eloquent\Collection |
||
145 | */ |
||
146 | public static function byUuid($uuid) |
||
162 | |||
163 | /** |
||
164 | * Returns non-administrative headers for accessing a server on the daemon. |
||
165 | * |
||
166 | * @param string $uuid |
||
167 | * @return array |
||
168 | */ |
||
169 | public function getHeaders() |
||
176 | |||
177 | /** |
||
178 | * Gets all allocations associated with this server. |
||
179 | * |
||
180 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
181 | */ |
||
182 | public function allocations() |
||
186 | |||
187 | /** |
||
188 | * Gets information for the pack associated with this server. |
||
189 | * |
||
190 | * @return \Illuminate\Database\Eloquent\Relations\HasOne |
||
191 | */ |
||
192 | public function pack() |
||
196 | |||
197 | /** |
||
198 | * Gets information for the service associated with this server. |
||
199 | * |
||
200 | * @return \Illuminate\Database\Eloquent\Relations\HasOne |
||
201 | */ |
||
202 | public function service() |
||
206 | |||
207 | /** |
||
208 | * Gets information for the service option associated with this server. |
||
209 | * |
||
210 | * @return \Illuminate\Database\Eloquent\Relations\HasOne |
||
211 | */ |
||
212 | public function option() |
||
216 | |||
217 | /** |
||
218 | * Gets information for the service variables associated with this server. |
||
219 | * |
||
220 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
221 | */ |
||
222 | public function variables() |
||
226 | |||
227 | /** |
||
228 | * Gets information for the node associated with this server. |
||
229 | * |
||
230 | * @return \Illuminate\Database\Eloquent\Relations\HasOne |
||
231 | */ |
||
232 | public function node() |
||
236 | } |
||
237 |
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: