@if ($entity->documents()->where('is_public',1)->count() > 0 || $entity->company->documents()->where('is_public',1)->count() > 0 || ($entity->expense && $entity->expense->invoice_documents) || ($entity->task && $entity->company->invoice_task_documents))

{{ ctrans('texts.attachments') }}:

@foreach ($entity->documents()->where('is_public',1)->get() as $document)
@if($entity instanceof App\Models\PurchaseOrder) {{ Illuminate\Support\Str::limit($document->name, 40) }} @else {{ Illuminate\Support\Str::limit($document->name, 40) }} @endif @if (!$loop->last) @endif
@endforeach @foreach ($entity->company->documents()->where('is_public',1)->get() as $document)
@if($entity instanceof App\Models\PurchaseOrder) {{ Illuminate\Support\Str::limit($document->name, 40) }} @else {{ Illuminate\Support\Str::limit($document->name, 40) }} @endif @if (!$loop->last) @endif
@endforeach @if($entity instanceof App\Models\Invoice) @foreach ($entity->expense_documents() as $expense) @foreach($expense->documents as $document) @endforeach @endforeach @endif @if($entity instanceof App\Models\Invoice) @foreach ($entity->task_documents() as $task) @foreach($task->documents as $document) @endforeach @endforeach @endif
@endif