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,11 +79,17 @@ 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;
|
||||
$images = [];
|
||||
$new = Location::create([
|
||||
'uuid' => Uuid::uuid4(),
|
||||
'name' => $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…
Reference in a new issue