From b25f7573a6b1456ca8c6dde004f302446cc59c29 Mon Sep 17 00:00:00 2001 From: Abraham Arango Date: Thu, 17 Feb 2022 19:18:46 -0500 Subject: [PATCH] Support for full text search Recently Laravel added support for full-text search where clauses in the query builder. https://laravel.com/docs/9.x/queries#full-text-where-clauses Looks like using that functionality with this package throws an error in line 240 of CacheKey.php because it didn't properly handle that where clause. This pull request makes a few changes to support full-text where clauses. --- src/CacheKey.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/CacheKey.php b/src/CacheKey.php index 441d002..ef9aaf2 100644 --- a/src/CacheKey.php +++ b/src/CacheKey.php @@ -177,7 +177,11 @@ protected function getOtherClauses(array $where) : string $value = $this->getTypeClause($where); $value .= $this->getValuesClause($where); - return "-{$where["column"]}_{$value}"; + $column = ""; + $column .= isset($where["column"]) ? $where["column"] : ""; + $column .= isset($where["columns"]) ? implode("-", $where["columns"]) : ""; + + return "-{$column}_{$value}"; } protected function getQueryColumns(array $columns) : string @@ -231,7 +235,7 @@ protected function getTableSlug() : string protected function getTypeClause($where) : string { - $type = in_array($where["type"], ["InRaw", "In", "NotIn", "Null", "NotNull", "between", "NotInSub", "InSub", "JsonContains"]) + $type = in_array($where["type"], ["InRaw", "In", "NotIn", "Null", "NotNull", "between", "NotInSub", "InSub", "JsonContains", "Fulltext"]) ? strtolower($where["type"]) : strtolower($where["operator"]);