diff --git a/database/factories/TaskFactory.php b/database/factories/TaskFactory.php index 6b0f9b5..7082ea2 100644 --- a/database/factories/TaskFactory.php +++ b/database/factories/TaskFactory.php @@ -17,8 +17,6 @@ class TaskFactory extends Factory */ public function definition(): array { - $this->faker->languageCode('da_DK'); - $this->faker->locale('da_DK'); return [ 'name' => fake()->name(), diff --git a/src/Models/Task.php b/src/Models/Task.php index ca4c46a..34b02a9 100644 --- a/src/Models/Task.php +++ b/src/Models/Task.php @@ -108,7 +108,7 @@ public function scopeOverdue($query): mixed */ public function scopeDueToday($query): mixed { - return $query->where('due_date', now()->format('Y-m-d')); + return $query->whereDate('due_date', '=', now()); } /** @@ -117,7 +117,7 @@ public function scopeDueToday($query): mixed */ public function scopeDueTomorrow($query): mixed { - return $query->where('due_date', now()->addDay()->format('Y-m-d')); + return $query->whereDate('due_date', '=', now()->addDay()); } /** @@ -126,7 +126,7 @@ public function scopeDueTomorrow($query): mixed */ public function scopeDueThisWeek($query): mixed { - return $query->whereBetween('due_date', [now()->startOfWeek()->format('Y-m-d'), now()->endOfWeek()->format('Y-m-d')]); + return $query->whereBetween('due_date', [now()->startOfWeek(), now()->endOfWeek()]); } /** @@ -135,7 +135,7 @@ public function scopeDueThisWeek($query): mixed */ public function scopeDueNextWeek($query): mixed { - return $query->whereBetween('due_date', [now()->addWeek()->startOfWeek()->format('Y-m-d'), now()->addWeek()->endOfWeek()->format('Y-m-d')]); + return $query->whereBetween('due_date', [now()->addWeek()->startOfWeek(), now()->addWeek()->endOfWeek()]); } /** @@ -144,7 +144,7 @@ public function scopeDueNextWeek($query): mixed */ public function scopeDueThisMonth($query): mixed { - return $query->whereBetween('due_date', [now()->startOfMonth()->format('Y-m-d'), now()->endOfMonth()->format('Y-m-d')]); + return $query->whereBetween('due_date', [now()->startOfMonth(), now()->endOfMonth()]); } /** @@ -153,7 +153,7 @@ public function scopeDueThisMonth($query): mixed */ public function scopeDueNextMonth($query): mixed { - return $query->whereBetween('due_date', [now()->addMonth()->startOfMonth()->format('Y-m-d'), now()->addMonth()->endOfMonth()->format('Y-m-d')]); + return $query->whereBetween('due_date', [now()->addMonth()->startOfMonth(), now()->addMonth()->endOfMonth()]); } /** @@ -162,7 +162,7 @@ public function scopeDueNextMonth($query): mixed */ public function scopeDueThisYear($query): mixed { - return $query->whereBetween('due_date', [now()->startOfYear()->format('Y-m-d'), now()->endOfYear()->format('Y-m-d')]); + return $query->whereBetween('due_date', [now()->startOfYear(), now()->endOfYear()]); } /** @@ -171,7 +171,7 @@ public function scopeDueThisYear($query): mixed */ public function scopeDueNextYear($query): mixed { - return $query->whereBetween('due_date', [now()->addYear()->startOfYear()->format('Y-m-d'), now()->addYear()->endOfYear()->format('Y-m-d')]); + return $query->whereBetween('due_date', [now()->addYear()->startOfYear(), now()->addYear()->endOfYear()]); } /** @@ -252,7 +252,7 @@ public function scopeDueOnOrBetween($query, $from, $to): mixed */ public function scopeDueOnOrBeforeToday($query): mixed { - return $query->where('due_date', '<=', now()->format('Y-m-d')); + return $query->whereDate('due_date', '<=', now()); } /** @@ -261,7 +261,7 @@ public function scopeDueOnOrBeforeToday($query): mixed */ public function scopeDueOnOrAfterToday($query): mixed { - return $query->where('due_date', '>=', now()->format('Y-m-d')); + return $query->whereDate('due_date', '>=', now()); } /**