@props(['heading' => null, 'testimonials' => []]) @php $WORD_LIMIT = 100; @endphp

{{ $heading ?? 'Testimonials' }}

@foreach($testimonials as $testimonial)
@php $words = str_word_count(strip_tags($testimonial->content), 1); $truncated = implode(' ', array_slice($words, 0, $WORD_LIMIT)); $hasMoreWords = count($words) > $WORD_LIMIT; @endphp

{{ $truncated }}

@if($hasMoreWords) @endif
@if($testimonial->image) @else
{{ substr($testimonial->name, 0, 1) }}
@endif
{{ $testimonial->name }}
{{ $testimonial->description }}
@endforeach
@foreach($testimonials as $index => $testimonial) @endforeach
@foreach($testimonials as $testimonial) @php $words = str_word_count(strip_tags($testimonial->content), 1); $hasMoreWords = count($words) > $WORD_LIMIT; @endphp @if($hasMoreWords) @endif @endforeach