I\'m trying to create a blade directive to highlight some words that will return from my search query.
This is my blade directive:
class AppServiceProvid
Blade::directive('highlight', function($arguments){
list($arg1, $arg2) = explode(',',str_replace(['(',')',' ', "'"], '', $arguments));
$expressionValues = preg_split('/\s+/', $arg1);
$output = "";
foreach ($expressionValues as $value) {
$output .= str_replace($value, "".$value."", $arg2);
}
return "";
});