/** * @param array $relations * @return array */ private function getRelations(array $relations = []) { $with = is_array(Input::get('with')) ? Input::get('with') : $this->inputService->decode('with'); if (count($relations) > 0) { $with = $relations; } $result = []; $relations = $this->repository->relations(); foreach ($with as $key => $value) { if (in_array($key, $relations) || in_array($value, $relations)) { $result[$key] = $value; } } return $result; }