/** * Query scope for published items. */ public function scopePublished($query) { /* * If we're in dashboard don't apply filter */ if (\Route::getCurrentRoute()->getName() != 'dash.works') { $query->where('published_at', '<=', Carbon::now())->where('status', $this->PUBLISHED); } }