File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 44
55use Illuminate \Notifications \Notifiable ;
66use Pterodactyl \Models \Traits \Searchable ;
7+ use Illuminate \Database \Query \JoinClause ;
78use Znck \Eloquent \Traits \BelongsToThrough ;
89
910/**
@@ -272,7 +273,15 @@ public function variables()
272273 {
273274 return $ this ->hasMany (EggVariable::class, 'egg_id ' , 'egg_id ' )
274275 ->select (['egg_variables.* ' , 'server_variables.variable_value as server_value ' ])
275- ->leftJoin ('server_variables ' , 'server_variables.variable_id ' , '= ' , 'egg_variables.id ' );
276+ ->leftJoin ('server_variables ' , function (JoinClause $ join ) {
277+ // Don't forget to join against the server ID as well since the way we're using this relationship
278+ // would actually return all of the variables and their values for _all_ servers using that egg,\
279+ // rather than only the server for this model.
280+ //
281+ // @see https://github.com/pterodactyl/panel/issues/2250
282+ $ join ->on ('server_variables.variable_id ' , 'egg_variables.id ' )
283+ ->where ('server_variables.server_id ' , $ this ->id );
284+ });
276285 }
277286
278287 /**
You can’t perform that action at this time.
0 commit comments