'array', 'diff' => 'array', ]; public function scopeCreatesBefore($query, $date) { return $query->whereDate('created_at', '<=', Carbon::parse($date)); } public function scopeCreatesAfter($query, $date) { return $query->whereDate('created_at', '>=', Carbon::parse($date)); } public function scopeCreatesIn($query, $days) { return $days != "" ? $query->whereDate('created_at', '>=', Carbon::now()->modify('-'.$days.' day')->toDate()) : $query; } }