belongsTo(User::class, 'approved_user_id'); } public function createdBy() { return $this->belongsTo(User::class, 'created_user_id'); } public function depth() { $depth = 0; $current = $this; while (!is_null($current->parent)) { $current = $current->parent; $depth++; } return $depth; } public function parent() { return $this->belongsTo(PhotoComment::class, 'parent_comment_id'); } }