Последняя версия с сервера прошлого разработчика
This commit is contained in:
24
app/Domain/Payments/Observers/WithdrawalObserver.php
Executable file
24
app/Domain/Payments/Observers/WithdrawalObserver.php
Executable file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Payments\Observers;
|
||||
|
||||
use App\Domain\Points\Models\Point;
|
||||
use App\Domain\Payments\Models\Withdrawal;
|
||||
|
||||
class WithdrawalObserver
|
||||
{
|
||||
public function updated(Withdrawal $withdrawal)
|
||||
{
|
||||
$status = $withdrawal->status;
|
||||
$point_id = $withdrawal->point_id;
|
||||
|
||||
if($status === 'cancel'){
|
||||
Point::destroy($point_id);
|
||||
}
|
||||
if($status === 'success'){
|
||||
$point = Point::find($point_id);
|
||||
$point->type = "Вывод средств";
|
||||
$point->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user