invoiceninja/app/Jobs/Client/UpdateClientBalance.php
David Bomba f712b789ca
Fixes for tests (#3184)
* fix typo

* php-cs traits

* CS fixer pass

* Password protect User routes

* Implement checks to prevent editing a deleted record

* Clean up payment flows

* Fixes for tests
2019-12-31 08:59:12 +11:00

55 lines
1.0 KiB
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\Libraries\MultiDB;
use App\Models\Client;
use App\Models\Company;
use Illuminate\Foundation\Bus\Dispatchable;
class UpdateClientBalance
{
use Dispatchable;
protected $amount;
protected $client;
private $company;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Client $client, $amount, Company $company)
{
$this->amount = $amount;
$this->client = $client;
$this->company = $company;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
MultiDB::setDB($this->company->db);
$this->client->balance += $this->amount;
$this->client->save();
}
}