PHP code example of worksome / laravel-filters

1. Go to this page and download the library: Download worksome/laravel-filters library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

worksome / laravel-filters example snippets


// Using DI
public function __construct(private readonly \Worksome\Filters\FilterQuery $filter) {}

$filteredInstance = $this->filter
    ->model(TestModel::class)
    ->apply(TestModelFilter::class)
    ->input($input)
    ->get();

// Using the facade
$filteredStatic = \Worksome\Filters\Filter::model(TestModel::class)
    ->apply(TestModelFilter::class)
    ->input($input)
    ->get();