public function getDepth ($parent = 0)
    {
        $counter = 0;
        $r = true;

        while ($r) {
            $category = self::where('id' , $parent)->first();
            if ($category) {
                $counter++;
                $parent = $category->parent;
                if ($category->parent == 0) {
                    break;
                }
            } else
                break;
        }
        return $counter;
    }