setVatID( $vatID ); $this->handle(); } public function getRemoveAllowed() { return $this->removeAllowed; } private function setVatID( $vatID ) { $this->vatID = $vatID; } private function handle() { $this->setProject(); $this->setInvoices(); $this->setRemoveAllowed(); } private function setProject() { $projects = Project::whereVatId( $this->vatID ); $this->projects = $projects->count() == 0 ? TRUE : FALSE; } private function setInvoices() { $invoices = Invoice::whereVatId( $this->vatID ); $this->invoices = $invoices->count() == 0 ? TRUE : FALSE; } private function setRemoveAllowed() { if ( $this->projects === FALSE ) return $this->removeAllowed = FALSE; if ( $this->invoices === FALSE ) return $this->removeAllowed = FALSE; $this->removeAllowed = TRUE; } }