Find answers to commonly asked questions about using Rest Generic Class in your Laravel applications.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/charlietyn/rest-generic-class/llms.txt
Use this file to discover all available pages before exploring further.
General Usage
Does this package register routes for me?
Does this package register routes for me?
RestController:Can I use MongoDB with this package?
Can I use MongoDB with this package?
BaseModelMongo class specifically for MongoDB usage through the mongodb/laravel package.mongodb/laravel in your application. The package provides the base model but doesn’t include MongoDB dependencies.Is Spatie permission package required?
Is Spatie permission package required?
laravel-permission package is completely optional.The permission models, traits, and middleware are available if you choose to install spatie/laravel-permission, but the core functionality works without it.Does the package support hierarchical tree structures?
Does the package support hierarchical tree structures?
HIERARCHY_FIELD_ID constant and you pass the hierarchy parameter in requests.Performance
How does caching work?
How does caching work?
- Cache is applied to
list_allandget_oneoperations - Cache keys include model, query params, auth user, and selected headers
- Write operations automatically bump a model-level cache version to invalidate stale data
- Per-request control via
cache=falseorcache_ttl=120parameters
Accept-Language and X-Tenant-Id headers to prevent cross-tenant data leaks.See the Cache strategy for complete caching options.What are the performance limits for filtering?
What are the performance limits for filtering?
| Limit | Default | Config Key |
|---|---|---|
| Maximum nesting depth | 5 | filtering.max_depth |
| Maximum conditions | 100 | filtering.max_conditions |
config/rest-generic-class.php:How can I optimize queries with many relations?
How can I optimize queries with many relations?
- Only load relations you need
- Use field selection (
:id,name) on relations to limit columns - Enable caching for frequently accessed data
- Set appropriate cache TTLs based on data volatility
- Use pagination for large result sets
Configuration
Can I use different cache stores for different models?
Can I use different cache stores for different models?
REST_CACHE_STORE.However, you can:- Set different TTLs for list vs single record operations:
- Override TTL per request:
- Disable cache per request:
How do I enable query logging?
How do I enable query logging?
storage/logs/query.log.You can also configure the general log level:Why aren't my environment variable changes working?
Why aren't my environment variable changes working?
.env, clear the config cache:Development
Does the package include tests?
Does the package include tests?
- Feature tests for CRUD endpoints using your
RestControllersubclasses - Tests for
operfiltering and relation allowlist enforcement - Tests for hierarchy listing if you use
HIERARCHY_FIELD_ID - Authorization tests if using Spatie permissions
Can I extend or override the base classes?
Can I extend or override the base classes?
How do I contribute to the package?
How do I contribute to the package?
- Open issues on GitHub for bugs or feature requests
- Submit pull requests with improvements
- For security concerns, report them privately to the maintainer
Need More Help?
Still have questions?- Check the Troubleshooting guide for common errors
- Review the API Reference for detailed documentation
- Browse Usage examples for practical implementations
- Open an issue on GitHub