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
Post a Comment