mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-13 17:14:10 -08:00
Added a validation to Transformers/LocationsTransformer.php:transformLocations() in case location doesn't have children location (#7640)
This commit is contained in:
parent
2a6a381bc7
commit
9291e3ada3
|
@ -24,12 +24,14 @@ class LocationsTransformer
|
||||||
if ($location) {
|
if ($location) {
|
||||||
|
|
||||||
$children_arr = [];
|
$children_arr = [];
|
||||||
|
if(!is_null($location->children)){
|
||||||
foreach($location->children as $child) {
|
foreach($location->children as $child) {
|
||||||
$children_arr[] = [
|
$children_arr[] = [
|
||||||
'id' => (int) $child->id,
|
'id' => (int) $child->id,
|
||||||
'name' => $child->name
|
'name' => $child->name
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$array = [
|
$array = [
|
||||||
'id' => (int) $location->id,
|
'id' => (int) $location->id,
|
||||||
|
|
Loading…
Reference in a new issue