mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-09-29 21:11:12 -04:00
* Fixes for Store Payment Validation * Tests for Payments * Use custom validator to ensure payments are made ONLY to payable invoices * Working on custom payment validators * Update Client balance * fixes for client balance * Fixes for activity API
52 lines
924 B
PHP
52 lines
924 B
PHP
<?php
|
|
/**
|
|
* Invoice Ninja (https://invoiceninja.com)
|
|
*
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
*
|
|
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
|
|
*
|
|
* @license https://opensource.org/licenses/AAL
|
|
*/
|
|
|
|
namespace App\Jobs\Client;
|
|
|
|
|
|
use App\Models\Client;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
|
|
class UpdateClientBalance
|
|
{
|
|
use Dispatchable;
|
|
|
|
protected $amount;
|
|
|
|
protected $client;
|
|
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
|
|
public function __construct(Client $client, $amount)
|
|
{
|
|
$this->amount = $amount;
|
|
$this->client = $client;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
|
|
$this->client->balance += $this->amount;
|
|
$this->client->paid_to_date += $this->amount;
|
|
$this->client->save();
|
|
|
|
}
|
|
}
|