{{-- @param int|null $rating 1–5 (0 or null = empty) @param bool $showNumber default true — show (x/5) --}} @php $r = isset($rating) ? (int) $rating : 0; @endphp @if($r <= 0) @else @php $r = min(5, max(1, $r)); @endphp @for($i = 1; $i <= 5; $i++) @endfor @if(!isset($showNumber) || $showNumber) ({{ $r }}/5) @endif @endif