Browsing Resources
To enable the browsing of resources you must have added browse to the resource.enabled array. You may then specify the following configurations for browsing, which includes ordering, filtering, and searching
Routing
The route will be named {your-bakery-prefix}.{resource}.browse
Custom Query Modifier
You may wish to specify additional modification to the query in order to return relevant results, for example to support tenancy, or returning a user's own resources.
You can do this by specifying query_modifier as a fully qualified class name, which implements the ModifiesBakerySearch interface.
Security
As per the cascaded security specification, supporting allows guests, security gates, and security policies.
Transforming Results
collection specifies a HTTP Collection Resource to be returned with the contents of your search, if not specified then the collection itself will be returned
per_page specifies how many items per page to be returned
Search
search.enabled is a boolean specifying whether we allow fluffy searching
search.columns is an array of fields which will be fluffy searched
search.custom_handlers is an array of custom search handlers to be used, these classes must implement the ModifiesBakerySearch interface
Filtering
Filtering looks for specific matches, for example posts by category ID, you can specify columns on which you wish to filter, and custom filters for application specific filtering, such as "in stock"
Field filters as specified as column (or alias) value pairs in the request, for example ?banned=1 whereas filters are specified in a filters array, for example ?filters[]=in-stock
Custom filers must implement the HandlesBakeryFilter interface
Caching
You may wish to cache results returned by the browse functionality. If this is the case you can specify the following, the TTL is specified in seconds.
Expiring the cache is handled by events and listeners in your application, read more in the Caching documentation.
Ordering
You may specify that you wish for our resource collections to be ordered, if you wish for this to only be based on specific fields, specify order_fields as an array with the list of acceptable fields.
Custom Query Modifier
You may wish to specify additional modification to the query in order to return relevant results, for example to support tenancy, or returning a user's own resources.
You can do this by specifying query_modifier as a fully qualified class name, which implements the ModifiesBakerySearch interface.
Example Declaration
Last updated