Skip to content

Commit

Permalink
[5.x] Allow filtering/sorting/paginating with the form:submissions
Browse files Browse the repository at this point in the history
…tag (#10826)

Co-authored-by: duncanmcclean <duncanmcclean@users.noreply.github.com>
  • Loading branch information
duncanmcclean and duncanmcclean authored Sep 27, 2024
1 parent e3a144d commit 94ba406
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/Forms/Tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
class Tags extends BaseTags
{
use Concerns\GetsFormSession,
Concerns\GetsQueryResults,
Concerns\GetsRedirects,
Concerns\OutputsItems,
Concerns\QueriesConditions,
Concerns\QueriesOrderBys,
Concerns\QueriesScopes,
Concerns\RendersForms;

const HANDLE_PARAM = ['handle', 'is', 'in', 'form', 'formset'];
Expand Down Expand Up @@ -184,9 +188,13 @@ public function submission()
*/
public function submissions()
{
$submissions = $this->form()->submissions();
$query = $this->form()->querySubmissions();

return $this->output($submissions);
$this->queryConditions($query);
$this->queryScopes($query);
$this->queryOrderBys($query);

return $this->output($this->results($query));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Stache/Query/SubmissionQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Statamic\Stache\Query;

use Illuminate\Support\Collection;
use Statamic\Contracts\Forms\SubmissionQueryBuilder as QueryBuilderContract;
use Statamic\Data\DataCollection;
use Statamic\Facades;
use Statamic\Query\OrderBy;

Expand Down Expand Up @@ -46,7 +46,7 @@ public function orderBy($column, $direction = 'asc')

protected function collect($items = [])
{
return Collection::make($items);
return DataCollection::make($items);
}

protected function getFilteredKeys()
Expand Down

0 comments on commit 94ba406

Please sign in to comment.