From a278b77c2be33e118de4bdb8ed99c2d32ab097ce Mon Sep 17 00:00:00 2001 From: Daan Adriaan Date: Thu, 23 Apr 2020 11:45:53 +0200 Subject: [PATCH 01/14] Add type to listenerField --- src/ListenerField.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/ListenerField.php b/src/ListenerField.php index aff9299..41016b2 100644 --- a/src/ListenerField.php +++ b/src/ListenerField.php @@ -3,6 +3,7 @@ namespace Codebykyle\CalculatedField; use Illuminate\Http\Request; +use Laravel\Nova\Element; use Laravel\Nova\Fields\Field; class ListenerField extends Field @@ -13,6 +14,12 @@ class ListenerField extends Field * @var string */ public $component = 'listener-field'; + + /** + * The type of the field to show on the form + * @var string + */ + public $type = 'number'; /** * The event this fields listens for @@ -53,6 +60,19 @@ public function numberFormat($format) 'numberFormat' => $format ]); } + + /** + * Set the type of the field (string, number) + * + * @param $type + * @return Element + */ + public function setType($type) : Element + { + return $this->withMeta([ + 'type' => $type + ]); + } /** * The channel that the client side component listens to From c2efd7618530c65341b784d23ff7c86904566241 Mon Sep 17 00:00:00 2001 From: Daan Adriaan Date: Thu, 23 Apr 2020 11:48:37 +0200 Subject: [PATCH 02/14] Update FormField.vue --- resources/js/components/broadcaster-field/FormField.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/resources/js/components/broadcaster-field/FormField.vue b/resources/js/components/broadcaster-field/FormField.vue index 63e75d2..f6b9203 100644 --- a/resources/js/components/broadcaster-field/FormField.vue +++ b/resources/js/components/broadcaster-field/FormField.vue @@ -3,9 +3,10 @@