2025-01-24 21:37:05 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Services;
|
|
|
|
|
|
|
|
use App\Models\Payment;
|
|
|
|
|
|
|
|
class PaymentService
|
|
|
|
{
|
|
|
|
public function distributePayments()
|
|
|
|
{
|
|
|
|
$payments = Payment::where('unapplied_amount', '>', 0)->get();
|
|
|
|
|
|
|
|
foreach ($payments as $payment) {
|
2025-02-01 09:57:57 -08:00
|
|
|
$payment->applyToInvoices();
|
2025-01-24 21:37:05 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|