public function userComments($name) { $comments = Comment::where('name', '=', $name)->orderBy('created_at', 'asc')->get(); //for header $headerData = CommentsController::header(); $userData = FollowController::userData($name); return view('user', compact('headerData', 'comments', 'userData')); }
public function follower() { if (\Auth::guest()) { return redirect('/'); } $followers = $this->getFollower(); $followersData = array(); for ($i = 0; $i < count($followers); $i++) { $followersData[$i] = FollowController::userData($followers[$i]->follower); } //for header $headerData = CommentsController::header(); return view('follower', compact('headerData', 'followersData')); }