FIX: display only published pages - respect published_* settings

This commit is contained in:
Michal Kváček
2016-10-10 21:41:32 +02:00
parent 190ca25b2a
commit bfa0685f2e
2 changed files with 18 additions and 0 deletions
@@ -7,6 +7,7 @@ use App\Http\Controllers\Controller;
use App\Http\Requests\Request;
use App\Models\Content;
use App\Models\User;
use Carbon\Carbon;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Input;
@@ -98,6 +99,14 @@ class ArticleList extends Handler
$articles = ArticleModel::where('module_handler', Article::class)
->with('comments')
->with('category')
->where(function ($query) {
$query->where('published_from', '>', Carbon::now())
->orWhereNull('published_from');
})
->where(function ($query) {
$query->where('published_to', '<', Carbon::now())
->orWhereNull('published_to');
})
->orderBy('published_from', 'DESC')
->orderBy('created_at', 'DESC');