Employee ref: {{ $user->employee_ref }}
Job title: {{ $user->jobtitle }}
Company: {{ $user->company ? $user->getCompany->companyname : 'Unassigned' }}
Department: {{ $user->department ? $user->getDepartment->departmentname : 'Unassigned' }}
Division: {{ $user->division ? $user->getDivision->divisionname : 'Unassigned' }}
Role: {{ $user->role ? $user->getRole->rolename : 'Unassigned' }}
@php // Split the comma-separated role IDs into an array $Teams = explode(',', $user->team); // Retrieve the corresponding role names from the roles table $TeamNames = App\Models\Team::whereIn('id', $Teams)->pluck('team'); @endphp Team: @foreach ($TeamNames as $teamName) {{ $teamName }} @endforeach
Level: {{ $user->level }}
Location: {{ $user->location ? $user->getLocation->locationname : 'Unassigned' }}