Skip to content

Commit

Permalink
Laravel 6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mirovit committed Oct 25, 2019
1 parent 0ac67c3 commit ab75421
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;

abstract class Filter
{
Expand Down Expand Up @@ -84,7 +86,7 @@ public function sort(array $sort)
$builder = $this->builder;

// Convert to method for sorting - sortId, sortName, sortFirstName ...
$method = 'sort' . studly_case(str_replace('.', '_', $field));
$method = 'sort' . Str::studly(str_replace('.', '_', $field));

// If it is not a method, then try to do the orderBy query for the field
if(! method_exists($this, $method)) {
Expand All @@ -105,12 +107,12 @@ public function sort(array $sort)
*/
protected function filters()
{
$filters = array_dot($this->request->all());
$filters = Arr::dot($this->request->all());

foreach($filters as $filter => $value) {
unset($filters[$filter]);

$filter = studly_case(str_replace('.', '_', $filter));
$filter = Str::studly(str_replace('.', '_', $filter));

$filters[$filter] = $value;
}
Expand Down

0 comments on commit ab75421

Please sign in to comment.