diff --git a/routes/console.php b/routes/console.php index 5f36c368..052e6009 100644 --- a/routes/console.php +++ b/routes/console.php @@ -19,3 +19,9 @@ \Illuminate\Support\Facades\Schedule::command('app:check_email') ->everyMinute(); + + + +\Illuminate\Support\Facades\Schedule::call(function () { + (new \App\Domains\Projects\DailyReportService())->handle(); +})->dailyAt('05:00'); diff --git a/tests/Feature/Models/ProjectTest.php b/tests/Feature/Models/ProjectTest.php index 0ae8def1..dea47fd1 100644 --- a/tests/Feature/Models/ProjectTest.php +++ b/tests/Feature/Models/ProjectTest.php @@ -24,4 +24,14 @@ public function test_model(): void $this->assertNotNull($model->team->id); $this->assertNotNull($model->tasks->first()->id); } + + public function test_active() { + $model = Project::factory()->create([ + 'start_date' => now()->subDays(5), + 'end_date' => now()->subDays(2), + ]); + + $this->assertEmpty(Project::active()->get()); + } + }