Skip to content

Commit

Permalink
fis translations update
Browse files Browse the repository at this point in the history
  • Loading branch information
Mh-Asmi committed Nov 19, 2024
1 parent e3fe0cd commit 82ca459
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Ushahidi/Modules/V5/Actions/V5CommandHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Ushahidi\Modules\V5\Actions;

use App\Bus\Command\AbstractCommandHandler;
use Hamcrest\Arrays\IsArray;
use Ushahidi\Modules\V5\Models\Translation;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Exceptions\HttpResponseException;
Expand Down Expand Up @@ -104,11 +105,17 @@ protected function updateTranslations(
int $translatable_id,
string $type
) {
if (empty($translation_input)) {
return [];
// if (empty($translation_input)) {
// return [];
// }
if (is_array($translation_input)) {
Translation::where('translatable_id', $translatable_id)->where('translatable_type', $type)->delete();
if (count($translation_input)) {
return $this->saveTranslations($entity, $entity_array, $translation_input, $translatable_id, $type);
}
}
Translation::where('translatable_id', $translatable_id)->where('translatable_type', $type)->delete();
return $this->saveTranslations($entity, $entity_array, $translation_input, $translatable_id, $type);
return [];
// return $this->saveTranslations($entity, $entity_array, $translation_input, $translatable_id, $type);
} //end updateTranslations()

/**
Expand Down

0 comments on commit 82ca459

Please sign in to comment.