laravel - Store SMS template in database and render it later -


i need store sms template in database. hello, {{ $username }}.

apparently it'd solution use blade templates here. how can retrieve sms template database , compile variables? same way views when rendering blade templates instead render database?

one simple way create temp view file everytime want send sms template

$templatefromdatabase = 'hi, {{$username}}';  $tempfilepath = time().'.blade.php'; file::put($tempfilepath, $templatefromdatabase);  //render view $html = view::make($tempfilepath,['username'=>'my name']); 

Comments

Popular posts from this blog

javascript - Is getTimezoneOffset() stable during daylight saving transition? -

Why does PHP consider 0 to be equal to a string? -

formula - R: how to pass in a reference to the variable in glm or lm? -