This is pure code :
- 
public function getComments() {
- 
        $query = $this->con->prepare("SELECT * FROM comments WHERE videoId=:videoId AND responseTo=0 ORDER BY datePosted DESC");
- 
        $query->bindParam(":videoId", $id);
- 
- 
        $id = $this->getId(); 
- 
- 
        $query->execute(); 
- 
- 
        $comments = array(); 
- 
        while($row = $query->fetch(PDO::FETCH_ASSOC)) {
- 
            $comment = new Comment($this->con, $row, $this->userLoggedInObj, $id); 
- 
            array_push($comments, $comment); 
- 
        } 
- 
- 
        return $comments; 
- 
- 
    } 
- 
This is laravel code:
- 
public function getComments() {
- 
- 
        $id = $this->getId(); 
- 
         $query= DB::table('comments' )->where(['videoId' => $id ,'responseTo' =>0])->get();
- 
        $comments = array(); 
- 
        while( $row = $query) {
- 
            $comment = new Comment($row, $this->userLoggedInObj, $id); 
- 
            array_push($comments, $comment); 
- 
        } 
- 
        return $comments ; 
- 
    } 
Probably the problem withe
 FETCH_ASSOC
How can i use FETCH_ASSOC in laravel ? I think get() it use it manually