@foreach ($bedTypes as $bedType)

{{ $bedType->title }}

{{-- @if (count($bedType->beds) > 0) @foreach ($bedType->beds as $bed)
@if (!$bed->bedAssigns->isEmpty() && !$bed->is_available && ($bed->bedAssigns[0]->discharge_date == null || $bed->bedAssigns[0]->discharge_date > \Carbon\Carbon::now()->format('Y-m-d H:i:s')))
@else @php $isTrue = true; @endphp @foreach ($patientAdmissions as $patientAdmission) @if ($patientAdmission->bed->id == $bed->id && !$patientAdmission->bed->is_available && $patientAdmission->discharge_date == null) @php $isTrue = false; @endphp
@endif @endforeach @if ($isTrue == true)
{{ $bed->name }}
@endif @endif
@endforeach @else --}} @if (count($bedType->beds) > 0) @foreach ($bedType->beds as $bed)
@if (!$bed->bedAssigns->isEmpty() && !$bed->is_available) @foreach ($bed->bedAssigns->where('status', 1) as $bedAssign)
@endforeach @else @php $isTrue = true; @endphp @foreach ($patientAdmissions as $patientAdmission) @if ( $patientAdmission->bed->id == $bed->id && !$patientAdmission->bed->is_available && $patientAdmission->discharge_date == null) @php $isTrue = false; @endphp
@endif @endforeach @if ($isTrue == true)
{{ $bed->name }}
@endif @endif
@endforeach @else
No bed available.
@endif
@endforeach