has('entity') && request()->has('entity_id')) { $class = 'App\Models\\'.ucfirst(request()->input('entity')); $entity_obj = $class::whereId($this->decodePrimaryKey(request()->input('entity_id')))->company()->first(); } $subject = request()->input('subject') ?: ''; $body = request()->input('body') ?: ''; $labels = $this->makeFakerLabels(); $values = $this->makeFakerValues(); $body = str_replace(array_keys($labels), array_values($labels), $body); $body = str_replace(array_keys($values), array_values($values), $body); $converter = new CommonMarkConverter([ //'html_input' => 'strip', 'allow_unsafe_links' => false, ]); $data = [ 'subject' => request()->input('subject'), 'body' => $converter->convertToHtml($body), ]; return response()->json($data, 200); } }