mardi 8 mai 2018

Laravel: Show HTML Code and Laravel Syntax from Database?

in my App I have a table (cats) with 30 categories. The Table "cats" has a name and code field. Every Category needs different forms. To be more flexible and to make the code simpler, I am saving the HTML Code for the different forms directly into the Database.

I am able to fetch the content with:

{!! $cats->code !!}

The Content of the DB Field:

<label for="textfield">Text Field:</label>
<input type="text" name="textfield" id="textfield">

Well, with that simple code, everything runs fine, the HTML Syntax will be shown.

Now I tried with that Code, but this is not working. I think it could be, because I am mixing html with laravel syntax...

 <div class="form-group row">
                        <label for="email" class="col-sm-4 col-form-label text-md-right"></label>

                        <div class="col-md-6">
                            <input id="email" type="email" class="form-control" name="email" value="" required autofocus>

                            @if ($errors->has('email'))
                                <span class="invalid-feedback">
                                    <strong></strong>
                                </span>
                            @endif
                        </div>
                    </div>

Has anyone an idea how to solve this issue?

Kind Regards

Stefan



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire