Removalls and offers revenues
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 10/06/2018
|
||||
* Time: 15:56
|
||||
*/
|
||||
|
||||
class RemoveInvoices {
|
||||
|
||||
private $invoiceID;
|
||||
private $payments;
|
||||
private $removeAllowed;
|
||||
|
||||
public function __construct( $invoiceID )
|
||||
{
|
||||
$this->setInvoiceID($invoiceID);
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
private function setInvoiceID( $invoiceID )
|
||||
{
|
||||
$this->invoiceID = $invoiceID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setPayments();
|
||||
|
||||
$this->setRemoveAllowed();
|
||||
}
|
||||
|
||||
private function setPayments()
|
||||
{
|
||||
$payments = Payment::whereInvoiceId($this->invoiceID);
|
||||
|
||||
$this->payments = $payments->count() == 0 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
private function setRemoveAllowed()
|
||||
{
|
||||
$this->removeAllowed = $this->payments;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user