wip
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
namespace App\Modules\VisaMasterPaymentOrder\Models;
|
||||
|
||||
use App\Models\Branch\Branch;
|
||||
use App\Models\User;
|
||||
use App\Repos\Order\Loan\LoanOrderRepo;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
@@ -36,6 +38,27 @@ class VisaMasterPaymentOrder extends Model implements HasMedia
|
||||
'payment_reciever' => 'array',
|
||||
];
|
||||
|
||||
/**
|
||||
* The "booted" method of the model.
|
||||
*/
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::updated(function ($visaMasterPaymentOrder) {
|
||||
if ($visaMasterPaymentOrder->status === OrderRepo::COMPLETED) {
|
||||
$user = User::find($visaMasterPaymentOrder->user_id);
|
||||
|
||||
if (! $user) {
|
||||
return;
|
||||
}
|
||||
|
||||
sendSMS(
|
||||
phone: $user->phone,
|
||||
message: $visaMasterPaymentOrder->unique_id . 'belgili sargydyňyz kanagatlandyryldy. Banka ýüztutmagyňyzy Sizden haýyş edýäris.'
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Media collections
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user