diff --git a/app/Filters/QueryFilters.php b/app/Filters/QueryFilters.php index d9b7877d11..e5380da3ee 100644 --- a/app/Filters/QueryFilters.php +++ b/app/Filters/QueryFilters.php @@ -282,9 +282,8 @@ abstract class QueryFilters if($value == 'true') { return $this->builder->leftJoin('clients', function($join) { - $join->on('invoices.client_id', '=', 'clients.id') - ->where('clients.is_deleted', 0) - ->whereNull('clients.deleted_at'); + $join->on("{$this->builder->getQuery()->from}.client_id", '=', 'clients.id') + ->where('clients.is_deleted', 0); }); }