Return posts.

@return \Illuminate\Http\Resources\Json\AnonymousResourceCollection|\Illuminate\Http\JsonResponse
974597
public function index()
    {
        $entries = WinkTag::when(request()->has('search'), function ($q) {
            $q->where('name', 'LIKE', '%'.request('search').'%');
        })
            ->orderBy('created_at', 'DESC')
            ->withCount('posts')
            ->get();

        return TagsResource::collection($entries);
    }
1369519
public function get_collection_params() {
		$params = parent::get_collection_params();

		$params['context']['default'] = 'view';

		$params['after'] = array(
			'description'        => __( 'Limit response to resources published after a given ISO8601 compliant date.' ),
			'type'               => 'string',
			'format'             => 'date-time',
			'validate_callback'  => 'rest_validate_request_arg',
		);
		if ( post_type_supports( $this->post_type, 'author' ) ) {
			$params['author'] = array(
				'description'         => __( 'Limit result set to posts assigned to specific authors.' ),
				'type'                => 'array',
				'default'             => array(),
				'sanitize_callback'   => 'wp_parse_id_list',
			);
			$params['author_exclude'] = array(
				'description'         => __( 'Ensure result set excludes posts assigned to specific authors.' ),
				'type'                => 'array',
				'default'             => array(),
				'sanitize_callback'   => 'wp_parse_id_list',
			);
		}
		$params['before'] = array(
			'description'        => __( 'Limit response to resources published before a given ISO8601 compliant date.' ),
			'type'               => 'string',
			'format'             => 'date-time',
			'validate_callback'  => 'rest_validate_request_arg',
		);
		$params['exclude'] = array(
			'description'        => __( 'Ensure result set excludes specific ids.' ),
			'type'               => 'array',
			'default'            => array(),
			'sanitize_callback'  => 'wp_parse_id_list',
		);
		$params['include'] = array(
			'description'        => __( 'Limit result set to specific ids.' ),
			'type'               => 'array',
			'default'            => array(),
			'sanitize_callback'  => 'wp_parse_id_list',
		);
		if ( 'page' === $this->post_type || post_type_supports( $this->post_type, 'page-attributes' ) ) {
			$params['menu_order'] = array(
				'description'        => __( 'Limit result set to resources with a specific menu_order value.' ),
				'type'               => 'integer',
				'sanitize_callback'  => 'absint',
				'validate_callback'  => 'rest_validate_request_arg',
			);
		}
		$params['offset'] = array(
			'description'        => __( 'Offset the result set by a specific number of items.' ),
			'type'               => 'integer',
			'sanitize_callback'  => 'absint',
			'validate_callback'  => 'rest_validate_request_arg',
		);
		$params['order'] = array(
			'description'        => __( 'Order sort attribute ascending or descending.' ),
			'type'               => 'string',
			'default'            => 'desc',
			'enum'               => array( 'asc', 'desc' ),
			'validate_callback'  => 'rest_validate_request_arg',
		);
		$params['orderby'] = array(
			'description'        => __( 'Sort collection by object attribute.' ),
			'type'               => 'string',
			'default'            => 'date',
			'enum'               => array(
				'date',
				'relevance',
				'id',
				'include',
				'title',
				'slug',
			),
			'validate_callback'  => 'rest_validate_request_arg',
		);
		if ( 'page' === $this->post_type || post_type_supports( $this->post_type, 'page-attributes' ) ) {
			$params['orderby']['enum'][] = 'menu_order';
		}

		$post_type_obj = get_post_type_object( $this->post_type );
		if ( $post_type_obj->hierarchical || 'attachment' === $this->post_type ) {
			$params['parent'] = array(
				'description'       => __( 'Limit result set to those of particular parent ids.' ),
				'type'              => 'array',
				'sanitize_callback' => 'wp_parse_id_list',
				'default'           => array(),
			);
			$params['parent_exclude'] = array(
				'description'       => __( 'Limit result set to all items except those of a particular parent id.' ),
				'type'              => 'array',
				'sanitize_callback' => 'wp_parse_id_list',
				'default'           => array(),
			);
		}

		$params['slug'] = array(
			'description'       => __( 'Limit result set to posts with a specific slug.' ),
			'type'              => 'string',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['status'] = array(
			'default'           => 'publish',
			'description'       => __( 'Limit result set to posts assigned a specific status; can be comma-delimited list of status types.' ),
			'enum'              => array_merge( array_keys( get_post_stati() ), array( 'any' ) ),
			'sanitize_callback' => 'sanitize_key',
			'type'              => 'string',
			'validate_callback' => array( $this, 'validate_user_can_query_private_statuses' ),
		);
		$params['filter'] = array(
			'description'       => __( 'Use WP Query arguments to modify the response; private query vars require appropriate authorization.' ),
		);

		$taxonomies = wp_list_filter( get_object_taxonomies( $this->post_type, 'objects' ), array( 'show_in_rest' => true ) );
		foreach ( $taxonomies as $taxonomy ) {
			$base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;

			$params[ $base ] = array(
				'description'       => sprintf( __( 'Limit result set to all items that have the specified term assigned in the %s taxonomy.' ), $base ),
				'type'              => 'array',
				'sanitize_callback' => 'wp_parse_id_list',
				'default'           => array(),
			);
		}

		if ( 'post' === $this->post_type ) {
			$params['sticky'] = array(
				'description'       => __( 'Limit result set to items that are sticky.' ),
				'type'              => 'boolean',
				'sanitize_callback' => 'rest_parse_request_arg',
			);
		}

		return $params;
	}
232654
function ctc_get_posts() {

		// Get gallery pages/posts
		$posts = ctc_gallery_posts( array(
			'order'			=> $this->ctc_instance['order'],
			'orderby'		=> $this->ctc_instance['orderby'],
			'limit'			=> $this->ctc_instance['limit']
		) );

		// Return filtered
		return apply_filters( 'ctc_galleries_widget_get_posts', $posts );

	}
1107659
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();
        }

        $config = $this->getConfig();

        $pageTypes = $config['Rcm']['pageTypes'];

        return new ApiJsonModel($pageTypes, 0, 'Success');
    }
681819
public function index()
    {
        $parameters = $this->request->getParameters();
        $paginator = $this->repository->getPaginatedCollection($parameters);
        return $this->paginatedResponse($paginator);
    }
87167
public function getObjects()
    {
        $objects = array();
        foreach ($this->resourceManager->getCollectionsByStorage($this) as $collection) {
            $objects = array_merge($objects, $this->getObjectsByCollection($collection));
        }

        return $objects;
    }
1186867
public function listAction()
    {
        $metaSetManager = $this->get('phlexible_meta_set.meta_set_manager');
        $metaSet = $metaSetManager->findAll();

        $data = [];
        foreach ($metaSet as $set) {
            /* @var $set MetaSetInterface */

            $data[] = [
                'id' => $set->getId(),
                'name' => $set->getName(),
                'createdAt' => $set->getCreatedAt() ? $set->getCreatedAt()->format('Y-m-d H:i:s') : null,
                'createUser' => $set->getCreateUser(),
                'modifiedAt' => $set->getModifiedAt() ? $set->getModifiedAt()->format('Y-m-d H:i:s') : null,
                'modifyUser' => $set->getModifyUser(),
                'revision' => $set->getRevision(),
            ];
        }

        return new JsonResponse(['sets' => $data]);
    }
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'
        );
    }
181967
public function all()
    {
        $data = [];

        $page      = 1;
        $fetch_all = true;

        $resourceName = constant($this->type . '::RESOURCE');
        $url          = sprintf("%s/%s", self::ENDPOINT, $resourceName);
        if (isset($this->params['page'])) {
            $page      = $this->params['page'];
            $fetch_all = false;
        }

        while (true) {
            $response = $this->fetch($this->buildUrl($url, $this->params), $resourceName);

            if (count($response) > 0) {
                foreach ($response as $item) {
                    $data[] = new $this->type($item);
                }

                if (!$fetch_all) {
                    break;
                } else {
                    $page++;
                    $this->where(['page' => $page]);
                }
            } else {
                break;
            }
        }

        return $data;
    }
933566
public function getList()
    {
        $routeMatch = $this->getEvent()->getRouteMatch();
        $mode = $routeMatch->getParam('mode', false);
        $annee = $routeMatch->getParam('annee', 0);
        $processStateHandler = $this->getProcessStateHandler();
        $processes = $processStateHandler->getRunningProcessList($mode, $annee);
        $response = $this->getResponse();
        $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
        $serializer = $this->getSerializer();
        $processJson = $serializer->serialize($processes, 'json');
        $response->setContent($processJson);
        return $response;
    }
569889
public function query()
    {
        $sourceUUID = $this->getSourceUUID();
        if (empty($sourceUUID)) {
            return new JsonResponse([
                'status' => 'Error',
                'message' => 'Source UUID header must be defined',
            ], 400);
        }

        $authorUUID = $this
            ->userCredentialsProvider
            ->getUUID();

        $queryParameterBag = $this
            ->request
            ->query;

        $page = (int) $queryParameterBag->get('page', 1);
        $numPerPage = (int) $queryParameterBag->get('num_per_page', 10);
        $sortBy = json_decode($queryParameterBag->get(
            'sort_by',
            ['created_at' => 'desc']
        ), true);
        $indexedMetadataSortBy = [
            'indexed_metadata.' . key($sortBy) => $sortBy[key($sortBy)],
        ];

        $role = $this->userCredentialsProvider->isModerator()
            ? Author::ROLE_MODERATOR
            : Author::ROLE_USER;

        $result = $this
            ->commentRepository
            ->getCommentsBySource(
                $sourceUUID,
                $page,
                $numPerPage,
                $indexedMetadataSortBy,
                $role
            );

        if (!empty($authorUUID)) {
            foreach ($result->getComments() as $comment) {
                $this->setEditableInComment(
                    $comment,
                    $authorUUID
                );
            }
        }
        
        return new JsonResponse([
            'comments_result' => $result->toArray(),
            'user' => $this->userCredentialsProvider->toArray(),
        ], 200);
    }
216642
protected function getPostedData()
    {
        $resourcePostedDataMode = $this->getResource()->getPostedDataMethod();
        $endpointPostedDataMode = $this->getEndpoint()->getPostedDataMethod();

        $postedDataMode = $resourcePostedDataMode;
        if ($endpointPostedDataMode != PostedDataMethods::AUTO) {
            $postedDataMode = $endpointPostedDataMode;
        }

        $postedData = null;

        switch ($postedDataMode) {

            case PostedDataMethods::POST:
                $postedData = $this->request->getPost();
                break;

            case PostedDataMethods::JSON_BODY:
                $postedData = $this->request->getJsonRawBody(true);
                break;

            case PostedDataMethods::AUTO:
            default:
                $postedData = $this->request->getPostedData($this->getEndpoint()->getHttpMethod());
        }

        return $postedData;
    }
230155
public function getAll()
    {
        $model = new static::$model;

        $query = $model::with($model::$localWith);
        $this->qualifyCollectionQuery($query);

        // Handle pagination, if applicable
        $perPage = $model->getPerPage();
        if ($perPage) {
            $paginator = $query->paginate($perPage);

            return $this->response->paginator($paginator, $this->getTransformer());
        } else {
            $resources = $query->get();

            return $this->response->collection($resources, $this->getTransformer());
        }
    }
1026774
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\Country $repo */
        $repo = $this->getEntityManager()->getRepository(\Rcm\Entity\Country::class);

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

        return new ApiJsonModel($results, 0, 'Success');
    }
302770
public function getList()
    {
        $routeMatch = $this->getEvent()->getRouteMatch();
        
        $selectedProcess = $this->params()->fromQuery('process', array());
        if (empty($selectedProcess))
            $selectedProcess = array();
        $selectedLevels = $this->params()->fromQuery('levels', array());
        if (empty($selectedLevels))
            $selectedLevels = array();
        $alerts = $this->getAlertDataHandler()->getAlertsForProcess($selectedProcess, $selectedLevels);
        $response = $this->getResponse();
        $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
        $serializer = $this->getSerializer();
        $alertssJson = $serializer->serialize($alerts, 'json');
        $response->setContent($alertssJson);
        return $response;
    }
458353
public function index()
    {
        $apiRequest = RequestFactory::create();

        $page = $apiRequest->getPage();
        if (!$page->size()) {
            $page->setSize($this->pageSize);
        }

        $fields = $apiRequest->getFields();
        $sorting = $apiRequest->getSort();
        $included = $apiRequest->getIncludedRelationships();
        $filters = $apiRequest->getFilters();

        $resource = new ListResource($this->serializer, $page, $fields, $sorting, $included, $filters);

        $totalAmount = $this->totalAmountResourceCallable();
        $results = $this->listResourceCallable();

        $controllerAction = '\\'.get_called_class().'@index';
        $uri = $this->uriGenerator($controllerAction);

        return $this->addHeaders($resource->get($totalAmount, $results, $uri, get_class($this->getDataModel())));
    }
260583
public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();

        $entities = $em->getRepository('VeonikBlogBundle:Post')
            ->createQueryBuilder('p')
            ->orderBy('p.active', 'ASC')
            ->addOrderBy('p.datePublished', 'DESC')
            ->getQuery()
            ->getResult();

        return array(
            'entities' => $entities,
        );
    }