/** * @param Before $flow */ public function handle(Before $flow) { /** * @var RepositoryInterface|Adjustable $repository */ $repository = $flow->getRepository(); $criterias = $repository->getCriterias(); array_walk($criterias, function (&$criteria) use(&$repository) { /** * @var \Housekeeper\Contracts\CriteriaInterface $criteria */ $repository->applyCriteria($criteria); }); }
/** * @param Before $flow */ public function handle(Before $flow) { $action = $flow->getAction(); /** * Only get cache when Action is "Read". */ if ($action->isType(Action::READ)) { $cacheKey = $this->getCacheKey($flow); $cachedValue = $this->getCache($cacheKey); if (!is_null($cachedValue)) { $flow->setReturn($cachedValue); } } }