PHP code example of webdevjohn / filterable

1. Go to this page and download the library: Download webdevjohn/filterable 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/ */

    

webdevjohn / filterable example snippets


php artisan filter:component {NameOfComponent}

php artisan filter:component {NameOfComponent} {namespace}

App/Providers/AppServiceProvider.php    
    
    public function register()
    {
        $this->app->bind('FactoryAlias', function ($app) {
            return new \Webdevjohn\Filterable\FilterFactory(
                $app->make(\App\Filters\Components\YourComponent::class)
            );         
        });   
    }

php artisan filter:make {FilterName}

public function scopeFilters($query, $request)
{
    return $this->getFilterFactory('YourFilterFactory')->make($query, $request);
}

public function getLatestTracks($request)
{
	return $this->model->WithRelations()	
	                   ->Filters($request->input())
	                   ->orderBy('purchase_date', 'DESC')						
	                   ->take(12)
	                   ->get()
}