From 0384fab4216a1fc637565a54325fb0a1a13099c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Mon, 10 Oct 2016 21:45:31 +0200 Subject: [PATCH] FIX: fix published_from and published_to --- app/Models/Content.php | 4 ++-- modules/Blog/ArticleList/Handlers/ArticleList.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Models/Content.php b/app/Models/Content.php index 1723966d..2c793c37 100644 --- a/app/Models/Content.php +++ b/app/Models/Content.php @@ -66,11 +66,11 @@ class Content extends Model ->with('author') ->join('modules', 'modules.handler', '=', 'contents.module_handler') ->where(function ($query) { - $query->where('published_from', '>', Carbon::now()) + $query->where('published_from', '<', Carbon::now()) ->orWhereNull('published_from'); }) ->where(function ($query) { - $query->where('published_to', '<', Carbon::now()) + $query->where('published_to', '>', Carbon::now()) ->orWhereNull('published_to'); }) ->where('language', LaravelLocalization::getCurrentLocale()) diff --git a/modules/Blog/ArticleList/Handlers/ArticleList.php b/modules/Blog/ArticleList/Handlers/ArticleList.php index 39838d4c..275e16d2 100644 --- a/modules/Blog/ArticleList/Handlers/ArticleList.php +++ b/modules/Blog/ArticleList/Handlers/ArticleList.php @@ -100,11 +100,11 @@ class ArticleList extends Handler ->with('comments') ->with('category') ->where(function ($query) { - $query->where('published_from', '>', Carbon::now()) + $query->where('published_from', '<', Carbon::now()) ->orWhereNull('published_from'); }) ->where(function ($query) { - $query->where('published_to', '<', Carbon::now()) + $query->where('published_to', '>', Carbon::now()) ->orWhereNull('published_to'); }) ->orderBy('published_from', 'DESC')