PHP code example of allenjd3 / scopify

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

    

allenjd3 / scopify example snippets


return [
    'default-namespace' => 'App\\Filters',
];

class User extends Authenticatable
{
    use Filterable;
}

...
public function scopeMyScope($query)
{
    return (new App\Filters\MyFilter)->call($query)
}

protected function scopifyFilters()
{
    return [
        'myScope' => MyFilter::class,
    ];
}

User::filters([
    MyFilter::class,
    MyOtherFilter::class,
])->get();
bash
php artisan vendor:publish --tag="scopify-config"
bash
php artisan make:scopify YourFilter