Top 20 Laravel Eloquent Enhancements
Eloquent shines as Laravel's key feature, and a vast range of add-on packages further enhances it. We'll explore a handpicked selection that's set to elevate your Laravel toolkit in this article.
1. Simplified Query Building with Spatie Laravel Package
The spatie/laravel-query-builder
package enhances your Laravel project, making it simple to apply filters, sort results, and manage Eloquent relationships directly through user requests.
For example, your website users could use a URL like this to interact with your data:
To find all users named John:
/users?filter[name]=John
To include related posts in the user data:
/users?include=posts
To sort users by their ID:
/users?sort=id
In your controller, you can handle these requests effortlessly: