From 93582b336fb0d5cdb54d12fd531776d8c4117b69 Mon Sep 17 00:00:00 2001 From: OscarOzaine Date: Tue, 11 Aug 2015 15:53:36 -0700 Subject: [PATCH 1/2] Validating if the data already exists if the data its already set, show that one, if its not query it all --- Widget.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Widget.php b/Widget.php index 22c1dcf..ff9a22e 100644 --- a/Widget.php +++ b/Widget.php @@ -45,7 +45,7 @@ public function run() $this->attributes = $this->model->attributes(); - $data = ($this->data) ? $this->data->asArray()->all() : []; + $data = isset($this->data) ? $this->data : $this->data->asArray()->all(); echo '
'; @@ -56,7 +56,7 @@ public function run() if (!in_array($value[$this->data_id], $selected)) { $ret .= '' . "\n"; - } else { + } else { $cnt++; $ret_sel .= '$("#dlb-'.$this->attribute.' .selected"). append("");'; From 474b3269b1b169bceea24cb31ef6e881a9d90dc8 Mon Sep 17 00:00:00 2001 From: OscarOzaine Date: Tue, 11 Aug 2015 16:52:02 -0700 Subject: [PATCH 2/2] Update Widget.php --- Widget.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Widget.php b/Widget.php index ff9a22e..237987f 100644 --- a/Widget.php +++ b/Widget.php @@ -45,7 +45,7 @@ public function run() $this->attributes = $this->model->attributes(); - $data = isset($this->data) ? $this->data : $this->data->asArray()->all(); + $data = ($this->data) ? $this->data->all() : []; echo '
';