0

I have to fetch one element from data passed to view. I have div with content like this:

<div class="disc" id="content">
    {!! $clause->contents !!}
</div>

It shows some text where i have element with heading 1 - h1. How can I fetch only this h1 element which I could use in somewhere else in view?

jakmen
  • 93
  • 10

1 Answers1

0

Better practice would be to have additional column for that heading in your database. Eg. $clause->title or $clause->heading, but since you're dealing with that problem you will have to extract that heading through DOM parser.

You can find detailed solution to this on this question which you can integrate into your controller.

harisdev
  • 4,146
  • 5
  • 19
  • 25