<?php namespace Tussendoor\Reloadify\Concerns\Http;

use ReloadifyScoped\Illuminate\Database\Eloquent\Builder;
use Tussendoor\Reloadify\Http\Filters\Filter;

trait IsFilterable
{
    /**
     * Apply all relevant filters.
     *
     * @param  \Illuminate\Database\Eloquent\Builder $query
     * @param  \Tussendoor\Reloadify\Http\Filters\Filter $filter
     * @return \Illuminate\Database\Eloquent\Builder
     */
    public function scopeFilter(Builder $query, Filter $filter) : Builder
    {
        return $filter->apply($query);
    }
}