25 lines
562 B
PHP
Executable File
25 lines
562 B
PHP
Executable File
<?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();
|
|
}
|
|
}
|
|
}
|