Skip to content

Commit

Permalink
refactor to request->boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga committed Oct 20, 2020
1 parent 0abc9fc commit f5a2195
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/Fieldtypes/Entries.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Statamic\Http\Resources\CP\Entries\Entries as EntriesResource;
use Statamic\Http\Resources\CP\Entries\Entry as EntryResource;
use Statamic\Query\Scopes\Filters\Concerns\QueriesFilters;
use Statamic\Support\Str;

class Entries extends Relationship
{
Expand Down Expand Up @@ -71,9 +70,7 @@ public function getIndexItems($request)
$query->orderBy($sort, $this->getSortDirection($request));
}

$shouldPaginate = $request->has('paginate') ? Str::toBool($request->paginate) : true;

$items = $shouldPaginate ? $query->paginate() : $query->get();
$items = $request->boolean('paginate', true) ? $query->paginate() : $query->get();

return $items->preProcessForIndex();
}
Expand Down
4 changes: 1 addition & 3 deletions src/Fieldtypes/Terms.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ public function getIndexItems($request)
$query->orderBy($sort, $this->getSortDirection($request));
}

$shouldPaginate = $request->has('paginate') ? Str::toBool($request->paginate) : true;

return $shouldPaginate ? $query->paginate() : $query->get();
return $request->boolean('paginate', true) ? $query->paginate() : $query->get();
}

public function getResourceCollection($request, $items)
Expand Down

0 comments on commit f5a2195

Please sign in to comment.