jeudi 14 juin 2018

Getting variables declared in a template in laravel

I have dynamically created view in laravel which contains a set of variables.Before rendering the view I need to pass these variables by

$content = view(['template' => html_entity_decode($content)], $values)->render();

$content is the html template with variables.Eg: '<div><strong>Location: </strong>{!!$item->get("location")->{0}->{"title"}!!}<br />'.$values is the object array with values.Sometimes the values passed to the template does not contains the variables available in template.This causes the error'Trying to get non property on a object'.Is there any solution to get all variables inside the template before rendering in laravel.I tried with preg_match,but it makes the execution slower.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire