public function categories()
    {
        $findPostType = PostType::findBySlug($this->getTable());
        if(!$findPostType) {
            throw new \Exception("Categories  relations could not be made because the post type of the post #".$this->postID." could ont be found!");
        }
        return $this->customHasManyThrough(
            'App\Models\Category', 'App\Models\CategoryRelation',
            'postID', 'categoryID', 'postID', 'categoryID', $this->getTable()."_categories"
        )
            ->where('postTypeID', $findPostType->postTypeID);
    }
public function categories()
    {
        $findPostType = PostType::findBySlug($this->getTable());
        if(!$findPostType) {
            throw new \Exception("Categories  relations could not be made because the post type of the post #".$this->postID." could ont be found!");
        }
        return $this->customHasManyThrough(
            'App\Models\Category', 'App\Models\CategoryRelation',
            'postID', 'categoryID', 'postID', 'categoryID', $this->getTable()."_categories"
        )
            ->where('postTypeID', $findPostType->postTypeID);
    }
public function categories ( ) { $ findPostType = PostType :: findBySlug ( $ this -> getTable ( ) ) ; if ( ! $ findPostType ) { throw new \ Exception ( "Categories  relations could not be made because the post type of the post #" . $ this -> postID . " could ont be found!" ) ; } return $ this -> customHasManyThrough ( 'App\Models\Category' , 'App\Models\CategoryRelation' , 'postID' , 'categoryID' , 'postID' , 'categoryID' , $ this -> getTable ( ) . "_categories" ) -> where ( 'postTypeID' , $ findPostType -> postTypeID ) ; }
Categories that belong to a Post.

@return HasManyThrough
@throws \Exception
Categories that belong to a Post .