1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-10-27 20:32:28 +01:00

Fix behavior on automatic resource name setter

This commit is contained in:
Dane Everitt 2018-01-21 14:37:57 -06:00
parent 8dcab927e5
commit faaf27632c
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -39,6 +39,15 @@ class Fractal extends SpatieFractal
}
}
if (is_null($this->resourceName) && $this->data instanceof LengthAwarePaginator) {
$item = collect($this->data->items())->first();
if ($item instanceof Model) {
if (defined(get_class($item) . '::RESOURCE_NAME')) {
$this->resourceName = constant(get_class($item) . '::RESOURCE_NAME');
}
}
}
return parent::createData();
}
}