{{-- relationships with pivot table (n-n) --}} @php $column['value'] = $column['value'] ?? data_get($entry, $column['name'], collect([])); $column['escaped'] = $column['escaped'] ?? true; $column['prefix'] = $column['prefix'] ?? ''; $column['suffix'] = $column['suffix'] ?? ''; $column['limit'] = $column['limit'] ?? 32; $column['attribute'] = $column['attribute'] ?? (new $column['model'])->identifiableAttribute(); if($column['value'] instanceof \Closure) { $column['value'] = $column['value']($entry); } if($column['value'] !== null && !$column['value']->isEmpty()) { $related_key = $column['value']->first()->getKeyName(); $column['value'] = $column['value']->pluck($column['attribute'], $related_key); } $column['value'] = $column['value'] ->map(function($value) use ($column) { return Str::limit($value, $column['limit'], '…'); }) ->toArray(); @endphp @if(!empty($column['value'])) {{ $column['prefix'] }} @foreach($column['value'] as $key => $text) @php $related_key = $key; @endphp @includeWhen(!empty($column['wrapper']), 'crud::columns.inc.wrapper_start') @if($column['escaped']) {{ $text }} @else {!! $text !!} @endif @includeWhen(!empty($column['wrapper']), 'crud::columns.inc.wrapper_end') @if(!$loop->last), @endif @endforeach {{ $column['suffix'] }} @else {{ $column['default'] ?? '-' }} @endif