Skip to content

Commit

Permalink
Merge pull request #1 from savannabits/coolsam726-patch-1
Browse files Browse the repository at this point in the history
Update PrimevueDatatables.php
  • Loading branch information
coolsam726 authored Sep 30, 2021
2 parents 416a8ce + 4a90d82 commit 698fb4e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/PrimevueDatatables.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ class PrimevueDatatables
private array $filters;
private array $_dtParams;

public function __construct(Builder $query)
public function __construct()
{
$this->query = $query;
$this->_dtParams = json_decode(request()->get('dt_params', "[]"), true);
$this->_searchableColumns
= json_decode(request()->get('searchable_columns',"[]"), true);
Expand All @@ -44,9 +43,14 @@ public function searchableColumns(array $searchable_columns): static
return $this;
}

public function query(Builder $query): static {
$this->query = $query;
return $this;
}
public static function of(Builder $query): static
{
return new self($query);
$instance = new self($query);
return $instance->query($query);
}

public function make(): \Illuminate\Contracts\Pagination\LengthAwarePaginator
Expand Down

0 comments on commit 698fb4e

Please sign in to comment.