global progress

This commit is contained in:
2024-12-12 15:57:55 +01:00
parent 8de72cf6bb
commit 1591b11308
9 changed files with 532 additions and 163 deletions

View File

@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace App\Observers;
use App\Models\Wallet;
use App\Notifications\WalletBalanceLowNotification;
class WalletObserver
{
public function updated(Wallet $wallet)
{
// todo mettre le montant dans un fichier de config / une constante ou autre
// /!\ balance is in cents
if ($wallet->getOriginal('balance') > $wallet->balance && $wallet->balance < 1000) {
$wallet->user->notify(new WalletBalanceLowNotification($wallet));
}
}
}