@php $tenant = \App\Support\Facades\Tenancy::get(); $brandStyle = $tenant->brand_primary_color ? ":root { --color-brand-600: {$tenant->brand_primary_color}; } .dark { --color-brand-600: {$tenant->brand_primary_color}; }" : null; $user = auth()->user(); $navGroups = match(true) { (bool) $user->guardian => \App\Support\Navigation\ParentNav::groups('chat', $user->guardian), // Teacher/staff aren't reliably distinguished by the Teacher/Employee // relations (a teacher's Employee row may exist without a linked Teacher // row, or vice versa) โ€” the Spatie role is the authoritative signal, // matching how CourseOfferingController resolves "who can teach". $user->hasRole(['class_teacher', 'subject_teacher']) => \App\Support\Navigation\TeacherNav::groups('chat'), (bool) $user->student => \App\Support\Navigation\StudentNav::groups('chat'), $user->hasRole('staff') => [['label' => 'STAFF PANEL', 'items' => [ ['label' => 'Dashboard', 'icon' => 'home', 'url' => route('tenant.staff.dashboard'), 'active' => false], ['label' => 'Chat', 'icon' => 'phone', 'url' => route('tenant.chat.threads.index'), 'active' => true], ]]], default => \App\Support\Navigation\TenantNav::groups('communication-chat'), }; $brandSubtitle = match(true) { (bool) $user->guardian => 'Parent Panel', $user->hasRole(['class_teacher', 'subject_teacher']) => 'Teacher Panel', (bool) $user->student => 'Student Panel', $user->hasRole('staff') => 'Staff Panel', default => 'Administrator Admin', }; $guardian = $user->guardian; $focusStudent = $guardian ? \App\Support\Navigation\ParentNav::focusStudent($guardian) : null; @endphp @php $other = $thread->participants->pluck('user')->filter(fn ($p) => $p && $p->id !== $user->id)->first(); $otherPhoto = $other ? \App\Http\Controllers\Tenant\Communication\ChatThreadController::personPhotoPath($other) : null; $otherTag = $other ? \App\Http\Controllers\Tenant\Communication\ChatThreadController::personTag($other) : null; @endphp @if($guardian) @include('tenant.parent-panel.partials.child-switcher') @endif
@if($thread->isGroup()) @elseif($otherPhoto) {{ $other->name }} @else @endif

{{ $thread->isGroup() ? $thread->subject : $thread->participants->pluck('user.name')->filter()->implode(', ') }}

@if($thread->isGroup()) Group ยท {{ $thread->participants->count() }} members @elseif($otherTag) {{ $otherTag['label'] }} @endif @if(!$thread->isGroup() && $thread->subject) {{ $thread->subject }} @endif
@php $initialMessages = \App\Http\Resources\ChatMessageResource::collection($messages)->response(request())->getData(true)['data']; @endphp

No messages yet โ€” say hello.