Skip to content

Commit 640ee9e

Browse files
committed
add the scheduler for trasks
1 parent 74961b2 commit 640ee9e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

routes/console.php

+6
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@
1919

2020
\Illuminate\Support\Facades\Schedule::command('app:check_email')
2121
->everyMinute();
22+
23+
24+
25+
\Illuminate\Support\Facades\Schedule::call(function () {
26+
(new \App\Domains\Projects\DailyReportService())->handle();
27+
})->dailyAt('05:00');

tests/Feature/Models/ProjectTest.php

+10
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,14 @@ public function test_model(): void
2424
$this->assertNotNull($model->team->id);
2525
$this->assertNotNull($model->tasks->first()->id);
2626
}
27+
28+
public function test_active() {
29+
$model = Project::factory()->create([
30+
'start_date' => now()->subDays(5),
31+
'end_date' => now()->subDays(2),
32+
]);
33+
34+
$this->assertEmpty(Project::active()->get());
35+
}
36+
2737
}

0 commit comments

Comments
 (0)