{{-- relationship_count (works for n-n relationships) --}} @php $value = data_get($entry, $column['name'])->count(); $column['escaped'] = $column['escaped'] ?? false; $column['prefix'] = $column['prefix'] ?? ''; $column['suffix'] = $column['suffix'] ?? ' items'; $column['text'] = ''; if($value) { $column['text'] = $column['prefix'].$value.$column['suffix']; } @endphp @includeWhen(!empty($column['wrapper']), 'crud::columns.inc.wrapper_start') @if($column['escaped']) {{ $column['text'] }} @else {!! $column['text'] !!} @endif @includeWhen(!empty($column['wrapper']), 'crud::columns.inc.wrapper_end')