close #252 Fixed: Invoice partial payments are unpredictable

This commit is contained in:
cuneytsenturk
2018-03-13 15:06:28 +03:00
parent 8573232586
commit 83ad45cdfa
11 changed files with 152 additions and 14 deletions

View File

@@ -0,0 +1,51 @@
<?php
namespace App\Listeners\Updates;
use App\Events\UpdateFinished;
use App\Models\Company\Company;
use App\Models\Income\InvoiceStatus;
use App\Models\Expense\BillStatus;
use Artisan;
class Version1115 extends Listener
{
const ALIAS = 'core';
const VERSION = '1.1.15';
/**
* Handle the event.
*
* @param $event
* @return void
*/
public function handle(UpdateFinished $event)
{
// Check if should listen
if (!$this->check($event)) {
return;
}
// Create new bill statuses
$companies = Company::all();
foreach ($companies as $company) {
$invoice = [
'company_id' => $company->id,
'name' => trans('invoices.status.delete'),
'code' => 'delete',
];
InvoiceStatus::create($invoice);
$bill = [
'company_id' => $company->id,
'name' => trans('bills.status.delete'),
'code' => 'delete',
];
BillStatus::create($bill);
}
}
}