private function deletePostType($id)
    {
        $postType = PostType::find($id);
        if(!$postType) {
            return false;
        }

        // Check if this post type has posts
        // Post type should not be able to be deleted if it has posts
        if(PostType::hasPosts($postType->slug) || PostType::isInMenuLinks($id)) {
            return $this->response("You can't delete this Post Type. There could be posts associated with it or it is part of a menu", 403);
        }

        if($this->deleteRelatedTagsAndCategory($postType) && $postType->delete()) {
            Schema::drop($postType->slug);

            // delete route file
            if(file_exists(base_path().'/routes/'.$postType->slug.'.php')) {
                unlink(base_path() . '/routes/' . $postType->slug . '.php');
            }
            return true;
        }

        return false;
    }
private function deletePostType($id)
    {
        $postType = PostType::find($id);
        if(!$postType) {
            return false;
        }

        // Check if this post type has posts
        // Post type should not be able to be deleted if it has posts
        if(PostType::hasPosts($postType->slug) || PostType::isInMenuLinks($id)) {
            return $this->response("You can't delete this Post Type. There could be posts associated with it or it is part of a menu", 403);
        }

        if($this->deleteRelatedTagsAndCategory($postType) && $postType->delete()) {
            Schema::drop($postType->slug);

            // delete route file
            if(file_exists(base_path().'/routes/'.$postType->slug.'.php')) {
                unlink(base_path() . '/routes/' . $postType->slug . '.php');
            }
            return true;
        }

        return false;
    }
private function deletePostType ( $ id ) { $ postType = PostType :: find ( $ id ) ; if ( ! $ postType ) { return false ; } // Check if this post type has posts // Post type should not be able to be deleted if it has posts if ( PostType :: hasPosts ( $ postType -> slug ) || PostType :: isInMenuLinks ( $ id ) ) { return $ this -> response ( "You can't delete this Post Type. There could be posts associated with it or it is part of a menu" , 403 ) ; } if ( $ this -> deleteRelatedTagsAndCategory ( $ postType ) && $ postType -> delete ( ) ) { Schema :: drop ( $ postType -> slug ) ; // delete route file if ( file_exists ( base_path ( ) . '/routes/' . $ postType -> slug . '.php' ) ) { unlink ( base_path ( ) . '/routes/' . $ postType -> slug . '.php' ) ; } return true ; } return false ; }
Delete post type by using ID.
Used in bulkDelete and delete functions.

@param  $id
@return array|bool
@throws \Exception
Delete post type by using ID . Used in bulkDelete and delete functions .