小调整

This commit is contained in:
2020-09-25 13:56:57 +08:00
parent e56cdf597a
commit 737a66b0c6
5 changed files with 59 additions and 48 deletions

View File

@@ -74,4 +74,15 @@ class Category extends Model
return $ids;
}
public function getTop()
{
$parent = $this;
while ($parent->parent_id) {
$parent->parent;
}
return $parent;
}
}