app/Models/Traits/HasCategoryTrait.php
public function getRevisedCategoryAttribute($id)
    {
        if ($id) {
            $category = $this->category()->find($id);

            if ($category instanceof Category) {
                return $category->trail;
            }
        }

        return;
    }
public function getRevisedCategoryAttribute($id)
    {
        if ($id) {
            $category = $this->category()->find($id);

            if ($category instanceof Category) {
                return $category->trail;
            }
        }

        return;
    }
Retrieves the revised location attribute.

@param int|string $id

@return null|string