public function scopeFilter($query, array $input = [], $filter = null)
{
// Resolve the current Model's filter
if ($filter === null) {
$filter = $this->getModelFilterClass();
}
// Create the model filter instance
$modelFilter = new $filter($query, $input);
// Set the input that was used in the filter (this will exclude empty strings)
$this->filtered = $modelFilter->input();
// Return the filter query
return $modelFilter->handle();
}