Ad

Laravel Blade Template Name From Database

- 1 answer

I have a master blade file which will include another blade file based on a DB value like so:

@include('sign/templates/{{$SignRequest->form_template}}')

The db field form_template contains the name of the blade file to include. This name is passed to the master blade file correctly, but I can't figure out how to use this value within the include statement.

I get the following error:

View [sign.templates.<?php echo e($SignRequest->form_template); ?>] not found. 
Ad

Answer

@include('sign.templates.'.$SignRequest->form_template)
Ad
source: stackoverflow.com
Ad