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
about-updates
Ro 1 year ago
parent 91f717843d
commit fd7a6fd064
Signed by untrusted user: are0h
GPG Key ID: 29B551CDBD4D3B50

@ -79,12 +79,18 @@ class LocationController extends Controller
++$duplicates;
//update block count for existing item
$location->block_count = $blockcount;
//replace null with empty array
if ($location->images == null) {
$location->images = [];
};
$location->save();
} else {
// make new entries for instances not present
if ($item[0] != 'domain') {
++$fresh;
$new = Location::create([
$images = [];
$new = Location::create([
'uuid' => Uuid::uuid4(),
'name' => $item[0],
'url' => $item[0],
@ -93,7 +99,8 @@ class LocationController extends Controller
'rating' => $item[1],
'added_by' => 1,
'tags' => 'poor moderation, hate speech',
'block_count' => $blockcount
'block_count' => $blockcount,
'images' => $images,
]);
}
}

Loading…
Cancel
Save