Skip to content
This repository was archived by the owner on Feb 10, 2019. It is now read-only.
This repository was archived by the owner on Feb 10, 2019. It is now read-only.

How to output paging data? #391

Open
@lilianjin

Description

@lilianjin

PHP

class ProductsQuery extends Query
{
	protected $attributes = [
		'name'	=> 'Products Query'
	];

	public function type()
	{
		return GraphQL::pagination(
				GraphQL::type('Product')
			);
	}

	public function resolve($root, $args)
	{
		return app(ProductRepositoryInterface::class)
			->paginate([
				'per_page'	=> 6
			]);
	}
}

Query

{
    products {
      items {
        name
        str_id
        description
     }
   }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions