Skip to content

Commit

Permalink
Merge pull request #420 from FitzwilliamMuseum/issue-416-paginate-res…
Browse files Browse the repository at this point in the history
…earch

Add simple method
  • Loading branch information
portableant authored May 26, 2022
2 parents 05892f1 + 69c72b6 commit 7e4f2d6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/Http/Controllers/homeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function index(): View
$galleries = Galleries::list(3, '?');
$exhibitions = Exhibitions::listHome('current', 'tessitura_string', 3);
$news = NewsArticles::feature();
$research = ResearchProjects::list('?', 3);
$research = ResearchProjects::listSimple('?', 3);
$fundraising = FundRaising::list(4);
$objects = Highlights::homeList();
$things = ThingsToDo::list();
Expand Down
20 changes: 20 additions & 0 deletions app/Models/ResearchProjects.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,24 @@ public static function findByDepartment(): array
);
return $api->getData();
}

/**
* @param string $sort
* @param int $limit
* @return array
*/
public static function listSimple(string $sort = 'title', int $limit = 100): array
{
$api = new DirectUs;
$api->setEndpoint('research_projects');
$api->setArguments(
array(
'fields' => '*.*.*.*',
'meta' => 'result_count,total_count,type',
'sort' => $sort,
'limit' => $limit
)
);
return $api->getData();
}
}

0 comments on commit 7e4f2d6

Please sign in to comment.