Get models.

@return \Illuminate\Http\JsonResponse
544772
public function index()
    {
        $id = request('menu_id');
        $models = $this->repository->where('menu_id', $id)->orderBy('position')->findAll()->nest();

        return response()->json($models, 200);
    }
136245
protected function getModel()
    {
        if (! $this->model) {
            $this->model = $this->createModel();

            $this->prepareModel($this->model);
        }

        return $this->model;
    }
895342
public function get()
    {
        $hasFrom = ! is_null($this->query->from);

        // When no from has been specified at this point the developer
        // tries to do a basic where query. In this case we want to use the index
        // path, since the index path is supposed to return collections.
        if (! $hasFrom) {
            $path = $this->model->getPath('index');
            $this->query->from($path);
        }

        $models = $this->getModels();

        return $this->model->newCollection($models);
    }
1218213
public function getData()
	{
		return !empty($this->data) ? $this->data : $this->getResponse([
			'sort' => $this->sort_column,
			'order' => $this->order_column,
			'limit' => $this->limit,
			'offset' => $this->offset,
			'filter' => $this->filter,
			'one' => $this->filter_one,
		]);
	}
1112360
public function getModels()
	{
		$models=array();
		if($this->_model!==null)
			$models[]=$this->_model;
		foreach($this->getElements() as $element)
		{
			if($element instanceof self)
				$models=array_merge($models,$element->getModels());
		}
		return $models;
	}
71298
public function getMapObjects() : GetMapObjectsResponse
    {
        $request = new GetMapObjects($this->position);
        return $this->service->execute($request, $this->position);
    }
1184698
protected function getModelIds()
    {
        $ids = [];

        foreach ($this->models as $model) {
            /** @var ModelInterface $model */
            $ids[] = $model->getId();
        }

        return $ids;
    }
980201
protected function getModels()
    {
        if ($this->_models === null) {
            $this->_models = [];
            $timings = $this->calculateTimings();

            foreach ($timings as $seq => $dbTiming) {
                $this->_models[] = [
                    'method' => $this->getRequestMethod($dbTiming['info']),
                    'type' => $this->getRequestType($dbTiming['category']),
                    'request' => $dbTiming['info'],
                    'duration' => ($dbTiming['duration'] * 1000), // in milliseconds
                    'trace' => $dbTiming['trace'],
                    'timestamp' => ($dbTiming['timestamp'] * 1000), // in milliseconds
                    'seq' => $seq,
                ];
            }
        }

        return $this->_models;
    }
958762
public function json()
    {
        $this->response->data = json_decode($this->response->body);

        return $this->response;
    }
76177
public function getList()
    {
        $siteId = $this->getRequestSiteId();

        //ACCESS CHECK
        $sitePagesResource = $this->getSitePagesResourceId($siteId);
        if (!$this->isAllowed('pages', 'read')
            && !$this->isAllowed(
                $sitePagesResource,
                'read'
            )
        ) {
            $this->getResponse()->setStatusCode(Response::STATUS_CODE_401);

            return $this->getResponse();
        }

        $site = $this->getSite($siteId);

        if (empty($site)) {
            return new ApiJsonModel(
                null,
                1,
                "Site was not found with id {$siteId}."
            );
        }

        $pages = $site->getPages();

        foreach ($pages as $key => $page) {
            $apiResponse = new SitePageApiResponse($page);

            $pages[$key] = $apiResponse;
        }

        return new ApiJsonModel(
            $pages,
            0,
            'Success'
        );
    }
333206
public function getMethods()
    {
        return array_reduce(
            $this->_models,
            function ($result, $item) {
                $result[$item['method']] = $item['method'];
                return $result;
            },
            []
        );
    }
284206
public function getList()
    {
        if ($this->kind === 'collection') {
            $model_class = $this->model_class;
            return $model_class::dump($this->where, $model_class::PRIMARY_KEY);
        }
        return [$this->where];
    }
1056944
public function getManagedModels()
    {
        $models = $this->getVersionedModels();

        // Normalize models to have their model class in array key and all names as the value are uppercased
        foreach ($models as $k => $v) {
            $archivedModels[$v] = array('title' => ucfirst(singleton($v)->i18n_plural_name()));
            unset($archivedModels[$k]);
        }

        return $archivedModels;
    }
938853
public function getList()
    {
        /** @var RcmUserService $rcmUserService */
        $rcmUserService = $this->serviceLocator->get(RcmUserService::class);

        //ACCESS CHECK
        if (!$rcmUserService->isAllowed(
            ResourceName::RESOURCE_SITES,
            'admin'
        )
        ) {
            $this->getResponse()->setStatusCode(Response::STATUS_CODE_401);
            return $this->getResponse();
        }

        /** @var \Rcm\Repository\Language $languageRepo */
        $languageRepo = $this->getEntityManager()->getRepository(\Rcm\Entity\Language::class);

        try {
            $languages = $languageRepo->findBy([], ['languageName' => 'ASC']);
        } catch (\Exception $e) {
            return new ApiJsonModel(null, 1, 'An error occurred will getting languages.');
        }

        return new ApiJsonModel($languages, 0, 'Success');
    }
1355195
public function getModel()
    {
        if (is_null($this->_model)) {
            $modelClass = $this->modelClass;
            $this->_model = new $modelClass();
        }

        return $this->_model;
    }
1176615
public function retrieveCustomObjects()
    {
        $objects = $this->retrieveMeta($requestParams = NULL);
        $objects = json_decode($objects, true);
        $objects = $objects["data"];

        $customObjects = array();
        if (is_array($objects))
        {
            foreach ($objects as $id => $data)
            {
                if ($id >= 10000)
                {
                    $customObjects[$id] = $data;
                }
            }
        }
        return $customObjects;
    }
253260
public function getResponses(): array
    {
        $responses = [];

        foreach ($this->responses as $request) {
            $responses[] = $this->responses[$request];
        }

        return $responses;
    }