fix JSON creator

This commit is contained in:
Билай Станислав 2024-08-08 11:15:07 +03:00
parent cba0498e7d
commit 850b0b315a
2 changed files with 2 additions and 3 deletions

View File

@ -50,7 +50,7 @@ class EloquentDataProvider
$this->meta['actions'] = $options['actions'] ?? []; $this->meta['actions'] = $options['actions'] ?? [];
$this->filters = $options['filters'] ?? []; $this->filters = $options['filters'] ?? [];
$this->createQuery(); $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 public function createQuery(): void

View File

@ -7,7 +7,7 @@ class JSONCreator
{ {
protected array $informationArray = []; 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']; $params = empty($meta['params']) ? ["class" => "table table-bordered", "border" => "1"] : $meta['params'];
if ($meta) { if ($meta) {
@ -27,7 +27,6 @@ class JSONCreator
{ {
if ($infArr) if ($infArr)
return json_encode($infArr, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); return json_encode($infArr, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
return null; return null;
} }