lundi 28 octobre 2019

Call a partial from a text that is stored in a database in laravel

I have a partial, that I can call with @include('partials/_tags') in a blade file. At the moment I create content using a rich-text-editor and store the data in the database. This is working fine. Now, I also want to insert partials into the the text-editor so that the partials are then displayed. Unfortunately, only the text @include('partials/_tags') is displayed, not the partial itself. I call the content from the database and display it then like the following.

@extends('main')
@section('title','Contact us')

@section('content')
  @foreach($pagedata as $data)
    <!-- Display the content including the partial here -->
    {!! $data->content !!}<br>
  @endforeach
@endsection

The content with the partial information is stored in the database like the following.

Test content <br><div>@include('partials/_tags')</div><div><br></div>Further content

How can I achieve, that the partial is displayed and not the code that calls the partial?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/32QGo6G
via IFTTT

Aucun commentaire:

Enregistrer un commentaire