36 lines
931 B
PHP
36 lines
931 B
PHP
<?php
|
|
|
|
namespace App\Jobs\Payment;
|
|
|
|
use App\Http\Services\Telegram;
|
|
use App\Models\Customer;
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
|
|
class GetPaymentMessage implements ShouldQueue
|
|
{
|
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
|
protected int $customerId;
|
|
protected float $amount;
|
|
|
|
public function __construct(int $customerId, float $amount)
|
|
{
|
|
$this->customerId = $customerId;
|
|
$this->amount = $amount;
|
|
}
|
|
|
|
public function handle(): void
|
|
{
|
|
$customer = Customer::find($this->customerId);
|
|
if ($customer) {
|
|
app(Telegram::class)->SendCustomerRecharge($customer, $this->amount);
|
|
// app(Discord::class)->SendCustomerRecharge($customer, $this->amount);
|
|
}
|
|
|
|
}
|
|
}
|