8889841c@php use App\Models\Task_Comments; use App\Models\Task_Post; //$comments = Task_Comments::with('commentUser')->latest()->take(12)->get(); $posts = Task_Post::with('postuser')->latest()->take(12)->get(); $userRole = Auth::user()->role_id; $userId = Auth::user()->id; $read = 1; $unread = 0; if ($userRole === 1) { $allComments = Task_Comments::with('commentUser', 'user')->orderBy('updated_at', 'desc')->take(50)->get(); } else { $Comments = Task_Comments::where('user_id', $userId) ->with('commentUser', 'user') ->orderBy('updated_at', 'desc') ->take(50) ->get(); } @endphp