Home > OS >  How can i hide dt if dd got empty value
How can i hide dt if dd got empty value

Time:05-04

I need to hide dt if dd got empty value. how can i do that?

  <dt   >Subject</dt>
   <dd >{{$course_dtl->subject_title }}</dd>

Like i want to hide Subject if subject_title has no value.

CodePudding user response:

As Brombeer said blade templating has if statements and you can surround the whole block with one:

@if (!empty($course_dtl->subject_title))
   <dt   >Subject</dt>
   <dd >{{$course_dtl->subject_title }}</dd>
@endif

CodePudding user response:

If you want to hide only dt then you can do this also

<dt  style="display: {{ $course_dtl->subject_title ? 'block' : 'none' }}" >Subject</dt>
<dd >{{$course_dtl->subject_title }}</dd>
  • Related