public function all()
    {
        $query = $this->model;

        if (Schema::hasColumn(str_plural($this->modelName), 'is_published')) {
            $query = $query->where('is_published', true);
        }

        if (Schema::hasColumn(str_plural($this->modelName), 'published_at')) {
            $query = $query->where('published_at', '<=', Carbon::now(config('app.timezone'))->format('Y-m-d H:i:s'));
        }

        if (Schema::hasColumn(str_plural($this->modelName), 'finished_at')) {
            $query = $query->where('finished_at', '>=', Carbon::now(config('app.timezone'))->format('Y-m-d H:i:s'));
        }

        return $query
            ->orderBy('created_at', 'desc')
            ->paginate(Config::get('cms.pagination', 24));
    }
public function all()
    {
        $query = $this->model;

        if (Schema::hasColumn(str_plural($this->modelName), 'is_published')) {
            $query = $query->where('is_published', true);
        }

        if (Schema::hasColumn(str_plural($this->modelName), 'published_at')) {
            $query = $query->where('published_at', '<=', Carbon::now(config('app.timezone'))->format('Y-m-d H:i:s'));
        }

        if (Schema::hasColumn(str_plural($this->modelName), 'finished_at')) {
            $query = $query->where('finished_at', '>=', Carbon::now(config('app.timezone'))->format('Y-m-d H:i:s'));
        }

        return $query
            ->orderBy('created_at', 'desc')
            ->paginate(Config::get('cms.pagination', 24));
    }
public function all ( ) { $ query = $ this -> model ; if ( Schema :: hasColumn ( str_plural ( $ this -> modelName ) , 'is_published' ) ) { $ query = $ query -> where ( 'is_published' , true ) ; } if ( Schema :: hasColumn ( str_plural ( $ this -> modelName ) , 'published_at' ) ) { $ query = $ query -> where ( 'published_at' , '<=' , Carbon :: now ( config ( 'app.timezone' ) ) -> format ( 'Y-m-d H:i:s' ) ) ; } if ( Schema :: hasColumn ( str_plural ( $ this -> modelName ) , 'finished_at' ) ) { $ query = $ query -> where ( 'finished_at' , '>=' , Carbon :: now ( config ( 'app.timezone' ) ) -> format ( 'Y-m-d H:i:s' ) ) ; } return $ query -> orderBy ( 'created_at' , 'desc' ) -> paginate ( Config :: get ( 'cms.pagination' , 24 ) ) ; }
Collect all items of a resource

@return Collection
Collect all items of a resource