private function _get_comments($coupon = 1) { $comments = Comment::leftJoin('user_users', 'comments.user_id', '=', 'user_users.id')->leftJoin('coupons', 'comments.coupon_id', '=', 'coupons.id')->whereNull('user_users.deleted_at')->whereNull('coupons.deleted_at')->where('coupons.id', '=', $coupon)->get(array(DB::raw('DATE_FORMAT(comments.created_at, "%e/%c/%Y") AS created'), 'comments.comment'))->toArray(); $rating = (double) Rating::where("coupon_id", "=", $coupon)->avg('value'); return array("comments" => $comments, "user_rating" => $this->_get_rating($coupon), "rating" => $rating); }
/** * get_profile function. * * @description Perfil de los usuarios registrados de la base de datos * @access public * @param mixed $id (default: null) * @return void */ public function getProfile($id = null) { if (!($data = $this->_validate($id))) { return Redirect::to('admin'); } $comments = Comment::leftJoin('coupons', 'comments.coupon_id', '=', 'coupons.id')->whereNull('coupons.deleted_at')->get(array('coupons.id', 'coupons.title', 'comments.comment', 'comments.created_at')); return View::make('admin.users.profile')->with("data", $data)->with("comments", $comments); }