{!! $key !!}
@foreach($value as $search)
{!! $search->title ?? @$search->name !!}
@php
$description = "";
if($key == "Pages") {
$metaArr = $search->metaArr();
$description = strip_tags(@$metaArr['about_description'] ?? @$metaArr['content_description']);
} else if(isset($search->description)) {
$description = strip_tags($search->description);
}
if($description) {
if (strpos($description, request()->get('keywords')) !== false) {
$array = explode(request()->get('keywords'), $description);
if(isset($array[0])) {
$description = "...".substr($array[0], -50);
}
$description .= " ".request()->get('keywords')." ";
if(isset($array[1])) {
$description .= substr($array[1], 0,50)."...";
}
} else {
$description = substr($description, 0,50)."...";
}
}
@endphp
{!! $description ?? "" !!}
@endforeachOops! We can't find anything that matches your search. Please try again.