Skip to content

Commit

Permalink
Merge pull request #115 from robertmarney/main
Browse files Browse the repository at this point in the history
Do not cast string 0 to float within Text field
  • Loading branch information
Tarpsvo authored Sep 9, 2024
2 parents 5383ab2 + ec6cef4 commit cb69350
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/TranslatableFieldMixin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use Illuminate\Support\Arr;
use Laravel\Nova\Fields\Markdown;
use Laravel\Nova\Fields\Textarea;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Fields\Number;
use Laravel\Nova\Http\Requests\NovaRequest;

class TranslatableFieldMixin
Expand Down Expand Up @@ -73,6 +75,12 @@ public function translatable()
? $options['fillOtherLocalesFrom']
: config('nova-translatable.fill_other_locales_from', null);

if($this instanceof Text && !$this instanceof Number) {
foreach ($value as $key => $val) {
$value[$key] = ( $val === null ? null : (string) $val );
}
}

$translatable = [
'original_attribute' => $this->attribute,
'original_component' => $component,
Expand Down

0 comments on commit cb69350

Please sign in to comment.