diff --git a/src/EloquentDataProvider.php b/src/EloquentDataProvider.php index 853da54..1d730b8 100644 --- a/src/EloquentDataProvider.php +++ b/src/EloquentDataProvider.php @@ -50,7 +50,7 @@ class EloquentDataProvider $this->meta['actions'] = $options['actions'] ?? []; $this->filters = $options['filters'] ?? []; $this->createQuery(); - $this->jsonStr = (new JSONCreator($this->meta, $this->filters, $this->getCollection()->toArray()))->getJson(); + $this->jsonStr = (new JSONCreator($this->meta, $this->getCollection()->toArray(), $this->filters,))->getJson(); } public function createQuery(): void diff --git a/src/JSONCreator.php b/src/JSONCreator.php index 617262c..05fea2c 100644 --- a/src/JSONCreator.php +++ b/src/JSONCreator.php @@ -7,7 +7,7 @@ class JSONCreator { protected array $informationArray = []; - public function __construct(array $meta, array $filters, array $data) + public function __construct(array $meta, array $data, array $filters = []) { $params = empty($meta['params']) ? ["class" => "table table-bordered", "border" => "1"] : $meta['params']; if ($meta) { @@ -27,7 +27,6 @@ class JSONCreator { if ($infArr) return json_encode($infArr, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); - return null; }