@php use App\Models\Scopes\BusinessScope; use App\Models\Guardian; @endphp @if (isset($business_data) && isset($students) && count($students) > 0)
@foreach ($students as $item) @php $guardians = Guardian::withoutGlobalScope(BusinessScope::class) ->leftJoin('user_guardian_relations', 'guardians.id', '=', 'user_guardian_relations.guardian_id') ->leftJoin( 'relation_types', 'relation_types.id', '=', 'user_guardian_relations.relation_type_id', ) ->where('guardians.business_id', auth()->user()->business_id) ->where('user_guardian_relations.user_id', $item->user_id) ->get(); // Get only mother (relation_type_id = 2) $mother = $guardians->firstWhere('relation_type_id', 2); // Get only father (relation_type_id = 1) $father = $guardians->firstWhere('relation_type_id', 1); @endphp

{{ $business_data->business_name }}

{{ $business_data->business_name }}

@php // dd($item->user); @endphp {{ $item->user->first_name ?? '' }} {{ $item->user->middle_name ?? '' }} {{ $item->user->last_name ?? '' }}

Class

ID

DOB

Section

:

:

:

:

{{ $item->academicClass->academic_class }} - {{ $item->academicClass->numeric_name }}

{{ $item->admission_no }}

{{ $item->user->dob ?? 'N/A' }}

{{ $item->academicYears->academic_year }}

Fathers Name

Mothers Name

Phone

Address

:

:

:

:

{{ $father->guardian_name ?? 'N/A' }}

{{ $mother->guardian_name ?? 'N/A' }}

{{ $item->user->mobile ?? 'N/A' }}

@if ($item->user) @if ($item->user->presentAddress) {{ $item->user->presentAddress->village_name ?? 'Lalpur ' }}{{ $item->user->presentAddress->upazilaThana && $item->user->presentAddress->upazilaThana->upazila_thana_name ? $item->user->presentAddress->upazilaThana->upazila_thana_name : 'Fatlulah ' }} {{ $item->user->presentAddress->division && $item->user->presentAddress->division->division_name ? $item->user->presentAddress->division->division_name : 'Narayanganj' }} @elseif($item->user->permanentAddress) {{ $item->user->permanentAddress->village_name ?? 'Lalpur ' }}{{ $item->user->permanentAddress->upazilaThana && $item->user->permanentAddress->upazilaThana->upazila_thana_name ? $item->user->permanentAddress->upazilaThana->upazila_thana_name : 'Fatlulah ' }} {{ $item->user->permanentAddress->division && $item->user->permanentAddress->division->division_name ? $item->user->permanentAddress->division->division_name : 'Narayanganj' }} @else Lalpur Fatlulah, narayanganj @endif @else Lalpur Fatlulah, narayanganj @endif

If the card is found anywhere other than the user, it is requested to submit it to the address below

{{ $business_data->address }}

{{ $business_data->phone ?? '' }} {{ $business_data->phone ? ', ' . $business_data->phone : '' }}

{{ $business_data->email ?? '' }}

{{ $business_data->business_url ?? '' }}

@endforeach
@else
No Card
@endif