public function index($page = 1) { $itemPerPage = 5; $videos = Video::getVideos(5, $page); /**/ return View::make("pages.vote")->with('videos', $videos)->with('page', $page); }
public function profile($username, $page = 1) { $data = User::where('username', $username)->first(); $query = DB::table('videos AS v')->join('users AS u', 'v.user_id', '=', 'u.id')->select(array('*')); $post_count = count($query->get()); $view_count = $query->sum('v.video_view_count'); $like_count = $query->sum('v.video_like_count'); $comment_count = $query->sum('v.video_comment_count'); $itemPerPage = 5; $videos = Video::getVideos($itemPerPage, $page); $photos = Photo::getPhotos($itemPerPage, $page); // @todo: show dung count return View::make('user.profile')->with('user', $data)->with('post_count', $post_count)->with('view_count', $view_count)->with('like_count', $like_count)->with('comment_count', $comment_count)->with('videos', $videos)->with('photos', $photos)->with('page', $page); }