Skip to content

Commit 6662e49

Browse files
authored
Merge pull request #3064 from codeeu/dev
Fix url event when search
2 parents 1e45fac + 326708d commit 6662e49

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

app/Services/GlobalSearchService.php

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,21 @@ public function search(string $filterKey, ?string $query = null): LengthAwarePag
110110
'Activities' AS category,
111111
description,
112112
picture AS thumbnail,
113-
event_url AS path,
114-
'external' AS link_type,
113+
CASE
114+
WHEN COALESCE(slug,'') <> ''
115+
THEN CONCAT('/view/', id, '/', slug)
116+
WHEN COALESCE(event_url,'') <> ''
117+
THEN CASE
118+
WHEN LEFT(event_url, 4) = 'http' THEN event_url
119+
ELSE CONCAT('http://', event_url)
120+
END
121+
ELSE '/events'
122+
END AS path,
123+
CASE
124+
WHEN COALESCE(slug,'') <> '' THEN 'internal'
125+
WHEN COALESCE(event_url,'') <> '' THEN 'external'
126+
ELSE 'internal'
127+
END AS link_type,
115128
'en' AS language,
116129
created_at,
117130
'' AS unique_identifier,
@@ -277,8 +290,21 @@ public function search(string $filterKey, ?string $query = null): LengthAwarePag
277290
'Activities' AS category,
278291
description,
279292
picture AS thumbnail,
280-
event_url AS path,
281-
'external' AS link_type,
293+
CASE
294+
WHEN COALESCE(slug,'') <> ''
295+
THEN CONCAT('/view/', id, '/', slug)
296+
WHEN COALESCE(event_url,'') <> ''
297+
THEN CASE
298+
WHEN LEFT(event_url, 4) = 'http' THEN event_url
299+
ELSE CONCAT('http://', event_url)
300+
END
301+
ELSE '/events'
302+
END AS path,
303+
CASE
304+
WHEN COALESCE(slug,'') <> '' THEN 'internal'
305+
WHEN COALESCE(event_url,'') <> '' THEN 'external'
306+
ELSE 'internal'
307+
END AS link_type,
282308
'en' AS language,
283309
created_at,
284310
'' AS unique_identifier,

0 commit comments

Comments
 (0)