Null images hotfix
The archived build errors out when it finds the images json field is null, so this will replace a null value with an empty array instead. Should probalby just make images non null and an empty array the default
This commit is contained in:
parent
91f717843d
commit
fd7a6fd064
1 changed files with 9 additions and 2 deletions
|
@ -79,12 +79,18 @@ class LocationController extends Controller
|
||||||
++$duplicates;
|
++$duplicates;
|
||||||
//update block count for existing item
|
//update block count for existing item
|
||||||
$location->block_count = $blockcount;
|
$location->block_count = $blockcount;
|
||||||
|
|
||||||
|
//replace null with empty array
|
||||||
|
if ($location->images == null) {
|
||||||
|
$location->images = [];
|
||||||
|
};
|
||||||
$location->save();
|
$location->save();
|
||||||
} else {
|
} else {
|
||||||
// make new entries for instances not present
|
// make new entries for instances not present
|
||||||
if ($item[0] != 'domain') {
|
if ($item[0] != 'domain') {
|
||||||
++$fresh;
|
++$fresh;
|
||||||
$new = Location::create([
|
$images = [];
|
||||||
|
$new = Location::create([
|
||||||
'uuid' => Uuid::uuid4(),
|
'uuid' => Uuid::uuid4(),
|
||||||
'name' => $item[0],
|
'name' => $item[0],
|
||||||
'url' => $item[0],
|
'url' => $item[0],
|
||||||
|
@ -93,7 +99,8 @@ class LocationController extends Controller
|
||||||
'rating' => $item[1],
|
'rating' => $item[1],
|
||||||
'added_by' => 1,
|
'added_by' => 1,
|
||||||
'tags' => 'poor moderation, hate speech',
|
'tags' => 'poor moderation, hate speech',
|
||||||
'block_count' => $blockcount
|
'block_count' => $blockcount,
|
||||||
|
'images' => $images,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue