From 61b6f6cd68f9cbe50bd9d43efbec77492d08fa68 Mon Sep 17 00:00:00 2001 From: Sohel Amin Date: Thu, 26 Oct 2017 01:30:54 +0600 Subject: [PATCH] Fix json select field --- src/Commands/CrudApiCommand.php | 2 +- src/Commands/CrudCommand.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Commands/CrudApiCommand.php b/src/Commands/CrudApiCommand.php index 815a859..7833db3 100644 --- a/src/Commands/CrudApiCommand.php +++ b/src/Commands/CrudApiCommand.php @@ -157,7 +157,7 @@ protected function processJSONFields($file) $fieldsString = ''; foreach ($fields->fields as $field) { if ($field->type == 'select') { - $fieldsString .= $field->name . '#' . $field->type . '#options=' . implode(',', $field->options) . ';'; + $fieldsString .= $field->name . '#' . $field->type . '#options=' . json_encode($field->options) . ';'; } else { $fieldsString .= $field->name . '#' . $field->type . ';'; } diff --git a/src/Commands/CrudCommand.php b/src/Commands/CrudCommand.php index b3253ae..b24e402 100644 --- a/src/Commands/CrudCommand.php +++ b/src/Commands/CrudCommand.php @@ -178,7 +178,7 @@ protected function processJSONFields($file) $fieldsString = ''; foreach ($fields->fields as $field) { if ($field->type == 'select') { - $fieldsString .= $field->name . '#' . $field->type . '#options=' . implode(',', (array) $field->options) . ';'; + $fieldsString .= $field->name . '#' . $field->type . '#options=' . json_encode($field->options) . ';'; } else { $fieldsString .= $field->name . '#' . $field->type . ';'; }