FIX: fix published_from and published_to

This commit is contained in:
Michal Kváček
2016-10-10 21:45:31 +02:00
parent b3ac9b9eec
commit 0384fab421
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -66,11 +66,11 @@ class Content extends Model
->with('author') ->with('author')
->join('modules', 'modules.handler', '=', 'contents.module_handler') ->join('modules', 'modules.handler', '=', 'contents.module_handler')
->where(function ($query) { ->where(function ($query) {
$query->where('published_from', '>', Carbon::now()) $query->where('published_from', '<', Carbon::now())
->orWhereNull('published_from'); ->orWhereNull('published_from');
}) })
->where(function ($query) { ->where(function ($query) {
$query->where('published_to', '<', Carbon::now()) $query->where('published_to', '>', Carbon::now())
->orWhereNull('published_to'); ->orWhereNull('published_to');
}) })
->where('language', LaravelLocalization::getCurrentLocale()) ->where('language', LaravelLocalization::getCurrentLocale())
@@ -100,11 +100,11 @@ class ArticleList extends Handler
->with('comments') ->with('comments')
->with('category') ->with('category')
->where(function ($query) { ->where(function ($query) {
$query->where('published_from', '>', Carbon::now()) $query->where('published_from', '<', Carbon::now())
->orWhereNull('published_from'); ->orWhereNull('published_from');
}) })
->where(function ($query) { ->where(function ($query) {
$query->where('published_to', '<', Carbon::now()) $query->where('published_to', '>', Carbon::now())
->orWhereNull('published_to'); ->orWhereNull('published_to');
}) })
->orderBy('published_from', 'DESC') ->orderBy('published_from', 'DESC')