global progress
This commit is contained in:
20
app/Observers/WalletObserver.php
Executable file
20
app/Observers/WalletObserver.php
Executable 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));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user