function dataListBugComments() { $userId = Session::get('userId'); if (!isset($userId)) { return json_encode(array('message' => 'not logged')); } $bugId = Session::get('currentBugId'); if (isset($bugId)) { $comments = BugComment::with(array('User', 'BugCommentFiles'))->where('bug_id', '=', $bugId)->get(); if ($comments && count($comments) > 0) { return json_encode(array('found' => true, 'comments' => $comments->toArray(), 'message' => 'logged')); } else { return json_encode(array('found' => false, 'message' => 'logged')); } } else { return json_encode(array('found' => false, 'message' => 'logged')); } }