Search code examples
jqueryhtmllaravelsummernote

How to display database populated summernote field to a page


I have a page to display some online training course. every course has a title and description. I want to get the description by summernote and It is the first time that I am using this plugin. I setup it. I get user data. and save it. But now I dont know how to display the saved summernote field from database to my page.

    @foreach ($courses as $course)
      <div class="col-md-6" id="coursebox_{{$course->id}}">
        <img class="rounded img-responsive courseImage" id="courseImage{{$course->id}}" src="images/{{$course->course_image}}" alt="" name="" style="width: 350px ; height :250px"> 
        <div class="blurb blurb-border mb-md-4"> 
          <i class=" pr-4 text-primary"></i>
          <div >
            <h6 class="mb-2  coursetitle" id="coursetitle{{$course->id}}">{{$course->course_title}}</h6>
            <div class="divincludep" contenteditable="true">
                <p class="coursedesc pinsidediv" id="coursedesc{{$course->id}}">{{$course->course_desc}}</p>
            </div>
            <a href="#" class="btn-read-more categorys" id="coursecat{{$course->id}}" data-id="{{$course->categories->id}}">{{$course->categories->category_title}}</a>
            <br>
            <h6 class="card-title" Style="margin-top: 1rem">Author : 
              <span style="font-size:1rem; font-weight:normal">{{$course->authors->name}}</span>
            </h6>
            <a href="#">
              <button type="button" class="btn btn-warning editmodalopen" data-coursebox="coursebox_{{$course->id}}" data-courseid="{{$course->id}}">Edit</button>
            </a>&nbsp;
            <button type="button" id="deleteCourseBox{{$course->id}}" class="btn btn-danger deleteCourseBox" data-coursebox="deletecoursebox_{{$course->id}}" data-courseid="{{$course->id}}">Delete</button>
          </div>
        </div>
      </div>
    @endforeach

This is the place that I want to display course description :

but the result is exact thing that I saved. But I want to display the formated text like the thing that I get from user.


Solution

  • Try

    {!! $course->course_desc !!}