<?php
namespace AppFiltersReport;
use Closure;
class Name
{
public function handle($request, Closure $next)
{
if (!request()->has('name') || request()->input('name') == null) {
return $next($request);
}
return $next($request)->whereRaw(
['$text' => ['$search' => request()->input('name')]]
);
}
}