Skip to content

refinephp/laravel-refine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Refine

Laravel Refine is a package that provides elegant and efficient query filtering and sorting for Laravel applications.

Installation

You can install the package via Composer:

composer require refinephp/laravel-refine
php artisan vendor:publish --tag=laravel-refine

Basic Usage

Filtering

To add filtering capabilities to your model, you can simply use the Filterable trait in your model:

use Refinephp\LaravelRefine\Traits\Filterable;

class User extends Model
{
    use Filterable;
}

Following that, you can use the filter method to filter your query results in your controller:

use App\Models\User;

class UserController extends Controller
{
    public function index()
    {
        return User::filter()->get();
    }
}

From your request, you can pass the filter parameters as query string parameters. For example:

GET /users?filters[name][$eq]=John&filters[age][$eq]=30

About

A Laravel package for elegant and efficient query filtering and sorting.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages