public function getAllPostsOfCategory($lang, $postType, $categoryID)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess($postType, 'read')) {
            return $this->noPermission();
        }
        // order info
        $orderBy = (isset($_GET['order'])) ? $_GET['order'] : 'postID';
        $orderType = (isset($_GET['type'])) ? $_GET['type'] : 'DESC';

        // get postIDs from relations
        $relations = DB::table(categoriesRelationTable($postType))->where('categoryID', $categoryID)->select('postID')->get();
        $postIDs = [];
        foreach ($relations as $postID){
            $postIDs[] = $postID->postID;
        }
        // get post list
        $list = DB::table($postType)->whereIn('postID', $postIDs)->orderBy($orderBy, $orderType)->paginate(Post::$rowsPerPage);
        return Language::filterRows($list);
    }
public function getAllPostsOfCategory($lang, $postType, $categoryID)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess($postType, 'read')) {
            return $this->noPermission();
        }
        // order info
        $orderBy = (isset($_GET['order'])) ? $_GET['order'] : 'postID';
        $orderType = (isset($_GET['type'])) ? $_GET['type'] : 'DESC';

        // get postIDs from relations
        $relations = DB::table(categoriesRelationTable($postType))->where('categoryID', $categoryID)->select('postID')->get();
        $postIDs = [];
        foreach ($relations as $postID){
            $postIDs[] = $postID->postID;
        }
        // get post list
        $list = DB::table($postType)->whereIn('postID', $postIDs)->orderBy($orderBy, $orderType)->paginate(Post::$rowsPerPage);
        return Language::filterRows($list);
    }
public function getAllPostsOfCategory ( $ lang , $ postType , $ categoryID ) { // check if user has permissions to access this link if ( ! User :: hasAccess ( $ postType , 'read' ) ) { return $ this -> noPermission ( ) ; } // order info $ orderBy = ( isset ( $ _GET [ 'order' ] ) ) ? $ _GET [ 'order' ] : 'postID' ; $ orderType = ( isset ( $ _GET [ 'type' ] ) ) ? $ _GET [ 'type' ] : 'DESC' ; // get postIDs from relations $ relations = DB :: table ( categoriesRelationTable ( $ postType ) ) -> where ( 'categoryID' , $ categoryID ) -> select ( 'postID' ) -> get ( ) ; $ postIDs = [ ] ; foreach ( $ relations as $ postID ) { $ postIDs [ ] = $ postID -> postID ; } // get post list $ list = DB :: table ( $ postType ) -> whereIn ( 'postID' , $ postIDs ) -> orderBy ( $ orderBy , $ orderType ) -> paginate ( Post :: $ rowsPerPage ) ; return Language :: filterRows ( $ list ) ; }
Get all post of a category.

@param string $lang       language slug
@param string $postType   post type slug
@param int    $categoryID selected category ID

@return array data of posts of a specific category
Get all post of a category .