<?php

namespace Modules\Cheque\QueryFilters;
use Closure;

class ExporterLastNameFilter
{
    public function handle($query, Closure $next)
    {
        if (request()->has('exporter_last_name')) {
            $query->whereHas('exporterable',function ($q){
                $q->where('last_name','LIKE','%'.request('exporter_last_name').'%');
            });
        }

        return $next($query);
    }
}