class Nested extends Model{
public function nestedfunc()
{
return $this->hasMany(Nested::class, 'parent_id');
}
public function childnestedfunc()
{
return $this->hasMany(Nested::class, 'parent_id')->with('nestedfunc');
}
}
//this is my model function for reccursion. how to add pagination to the root of the nested comments. i am storing all comments to the same table
- root comment 1 -nested comments of root 1 ....
- root comment 2 - nested comments of root 2 ....
- paginate the root comments
- root comments 3 - nested comments of root 3 ....
- root comments 4 -nested commets of root 4.....
- paginate the root comments
- so on