public function getAllPublishablePosts()
    {
        $collection = $this->getAll()->sortByDesc('updated_at');

        $filtered = $collection->filter(function ($item) {
            if ($item->enabled == 1) return true;
        });

        $filtered = $filtered->filter(function ($item) {
            $todaysDate = DatesHelper::todaysDateSetToLocalTime();
            if ($item->publish_on <= $todaysDate) return true;
        });

        // TODO: HAVE TO MANUALLY PAGINATE THE FILTERED COLLECTION :-(
        // https://laracasts.com/discuss/channels/laravel/laravel-pagination-not-working-with-array-instead-of-collection?page=1#reply-63860
        // http://www.reddit.com/r/laravel/comments/32kxn8/creating_a_paginator_manually/
        return $filtered->all();
    }
public function getAllPublishablePosts()
    {
        $collection = $this->getAll()->sortByDesc('updated_at');

        $filtered = $collection->filter(function ($item) {
            if ($item->enabled == 1) return true;
        });

        $filtered = $filtered->filter(function ($item) {
            $todaysDate = DatesHelper::todaysDateSetToLocalTime();
            if ($item->publish_on <= $todaysDate) return true;
        });

        // TODO: HAVE TO MANUALLY PAGINATE THE FILTERED COLLECTION :-(
        // https://laracasts.com/discuss/channels/laravel/laravel-pagination-not-working-with-array-instead-of-collection?page=1#reply-63860
        // http://www.reddit.com/r/laravel/comments/32kxn8/creating_a_paginator_manually/
        return $filtered->all();
    }
public function getAllPublishablePosts ( ) { $ collection = $ this -> getAll ( ) -> sortByDesc ( 'updated_at' ) ; $ filtered = $ collection -> filter ( function ( $ item ) { if ( $ item -> enabled == 1 ) return true ; } ) ; $ filtered = $ filtered -> filter ( function ( $ item ) { $ todaysDate = DatesHelper :: todaysDateSetToLocalTime ( ) ; if ( $ item -> publish_on <= $ todaysDate ) return true ; } ) ; // TODO: HAVE TO MANUALLY PAGINATE THE FILTERED COLLECTION :-( // https://laracasts.com/discuss/channels/laravel/laravel-pagination-not-working-with-array-instead-of-collection?page=1#reply-63860 // http://www.reddit.com/r/laravel/comments/32kxn8/creating_a_paginator_manually/ return $ filtered -> all ( ) ; }
Get all the posts

ENABLED, PUBLISH_ON <= TODAY, DESC

@return  collection
Get all the posts