Virtual pages from database question

In case anyone’s interested – after some experimenting it seems the example in docs DOES create new comments/database rows and it does do it in the child (comment) model. What I had to do to make it work was explicitly include all table’s columns in the DB::insert statement.

So I used this code instead of the lines in the pink box in the pic below:

            return Db::insert('comments', [
            'slug'  => $this->slug(),
            'text'  => '',
            'user'  => '',
        ]);

2 Likes