mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-12 20:20:41 -05:00
Eager Load Mod Relationships in Scout Model Methods
This commit is contained in:
parent
8b71dc2c02
commit
293e52726b
@ -108,6 +108,11 @@ class Mod extends Model
|
||||
*/
|
||||
public function toSearchableArray(): array
|
||||
{
|
||||
$this->load([
|
||||
'latestVersion',
|
||||
'latestVersion.latestSptVersion',
|
||||
]);
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
@ -138,6 +143,12 @@ class Mod extends Model
|
||||
return false;
|
||||
}
|
||||
|
||||
// Eager load the latest mod version, and it's latest SPT version.
|
||||
$this->load([
|
||||
'latestVersion',
|
||||
'latestVersion.latestSptVersion',
|
||||
]);
|
||||
|
||||
// Ensure the mod has a latest version.
|
||||
if ($this->latestVersion()->doesntExist()) {
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user