@php
$user = auth()->user();
$otherQuery = \App\Models\Announcement::active()
->where('id', '!=', $announcement->id);
if ($user->role === 'mahasiswa') {
$otherQuery->where(function($q) {
$q->where('target', 'mahasiswa')
->orWhere('target', 'all');
});
} elseif ($user->role === 'dosen') {
$otherQuery->where(function($q) {
$q->where('target', 'dosen')
->orWhere('target', 'all');
});
}
$otherAnnouncements = $otherQuery->orderBy('created_at', 'desc')->limit(5)->get();
$showRoute = $user->role === 'dosen' ? 'dosen.announcements.show' : 'mahasiswa.announcements.show';
@endphp
@forelse($otherAnnouncements as $other)
{{ $other->priority_label }}
{{ Str::limit($other->title, 40) }}
{{ $other->created_at->diffForHumans() }}
@empty
Tidak ada pengumuman lainnya
@endforelse