public function getCategoriesAttribute()
    {
        // Request category only if post type uses categories
        $getPostType = getPostType($this->getTable());

        if($getPostType->hasCategories) {
            return $this->getRelationValue('categories');
        }
        return null;
    }
public function getCategoriesAttribute()
    {
        // Request category only if post type uses categories
        $getPostType = getPostType($this->getTable());

        if($getPostType->hasCategories) {
            return $this->getRelationValue('categories');
        }
        return null;
    }
public function getCategoriesAttribute ( ) { // Request category only if post type uses categories $ getPostType = getPostType ( $ this -> getTable ( ) ) ; if ( $ getPostType -> hasCategories ) { return $ this -> getRelationValue ( 'categories' ) ; } return null ; }
Cached categories that belong to a post.

@return array|Collection|mixed
@throws \Exception
Cached categories that belong to a post .