Updated scheduled tasks

This commit is contained in:
2026-07-02 23:11:46 +10:00
parent 4c98b33fb4
commit 00bd30fc5e
17 changed files with 397 additions and 667 deletions
+8
View File
@@ -2,12 +2,15 @@
namespace App\Observers;
use App\Enums\FlightNotificationType;
use App\Models\User;
use App\Models\UserFlight;
use App\Services\FollowerNotificationService;
use Illuminate\Support\Facades\Cache;
class FlightObserver
{
protected function clearCache(UserFlight $flight): void
{
Cache::forget("user_flights_{$flight->user->id}");
@@ -27,6 +30,7 @@ class FlightObserver
{
$flight->user->calculateAchievements();
$this->clearCache($flight);
new FollowerNotificationService()->notifyFlightEvent($flight, FlightNotificationType::forCreation($flight));
}
/**
@@ -49,5 +53,9 @@ class FlightObserver
{
$flight->user->calculateAchievements();
$this->clearCache($flight);
if ($flight->departure_date->isFuture()) {
new FollowerNotificationService()->notifyFlightEvent($flight, FlightNotificationType::Cancelled);
}
}
}