Filter data

Note: These below filter parameters only work with DB::where("collection-name")->all() function.

Sort

Sort by DESC is default

You can sort by ASC from url as below

example.com/posts?sort=ASC

Limit

Limit by 0 index is default

You can limit collection from url as below

example.com/posts?limit=4

Only

only can retrieve the data with specific keys.

example.com/posts?only=title,author,category

Query examples

example.com/posts?limit=2
example.com/posts?sort=DESC
example.com/posts?limit=4&sort=ASC&only=title
example.com/posts?limit=10&sort=DESC&only=username,email

Last updated