Skip to content

Instantly share code, notes, and snippets.

@irzhywau
Last active June 21, 2019 16:09
Show Gist options
  • Save irzhywau/bb099b322545c25748927444f25b8fe5 to your computer and use it in GitHub Desktop.
Save irzhywau/bb099b322545c25748927444f25b8fe5 to your computer and use it in GitHub Desktop.
Retrieving data from cache
<?php
// this piece is wrapped in a method of the class in charge of handling data to / from cache
$this->bootCollection();
$dataset = $this->fetch($this->appViewStoragePath."{$app_id}-{$this->table->key}.json", true);
// --- Filter data (settings-based filters)
$dataset = $this->applyFilterAndSearch($dataset, $this->searchFilter);
// --- Filter data (user filters)
$dataset = $this->applyFilterAndSearch($dataset, array_get($state, 'filtered', []));
// --- all the rest: sorting, paginate before output the data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment