예제 #1
0
 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);
 }
예제 #2
0
 /**
  * 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);
 }