public function arePublic()
    {
        if (Schema::hasColumn($this->model->getTable(), 'is_published')) {
            $query = $this->model->where('is_published', 1);

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

            return $query->orderBy('created_at', 'desc')->get();
        }

        return $this->model->orderBy('created_at', 'desc')->get();
    }
public function arePublic()
    {
        if (Schema::hasColumn($this->model->getTable(), 'is_published')) {
            $query = $this->model->where('is_published', 1);

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

            return $query->orderBy('created_at', 'desc')->get();
        }

        return $this->model->orderBy('created_at', 'desc')->get();
    }
public function arePublic ( ) { if ( Schema :: hasColumn ( $ this -> model -> getTable ( ) , 'is_published' ) ) { $ query = $ this -> model -> where ( 'is_published' , 1 ) ; if ( Schema :: hasColumn ( $ this -> model -> getTable ( ) , 'published_at' ) ) { $ query -> where ( 'published_at' , '<=' , Carbon :: now ( config ( 'app.timezone' ) ) -> format ( 'Y-m-d H:i:s' ) ) ; } return $ query -> orderBy ( 'created_at' , 'desc' ) -> get ( ) ; } return $ this -> model -> orderBy ( 'created_at' , 'desc' ) -> get ( ) ; }
Returns all public items

@return \Illuminate\Database\Eloquent\Collection|static[]
Returns all public items