setProjectID( $projectID ); $this->handle(); } public function getRemoveAllowed() { return $this->removeAllowed; } private function setProjectID( $projectID ) { $this->projectID = $projectID; } private function handle() { $this->setForecast(); $this->setInvoices(); $this->setProjectemployees(); $this->setReservations(); $this->setRemoveAllowed(); $this->setProjectCosts(); } private function setForecast() { $forecast = Forecast::whereProjectId( $this->projectID ); $this->forecast = $forecast->count() == 0 ? TRUE : FALSE; } private function setInvoices() { $invoices = Invoice::whereProjectId( $this->projectID ); $this->invoices = $invoices->count() == 0 ? TRUE : FALSE; } private function setProjectemployees( ) { $setProjectemployees = Projectemployee::whereProjectId($this->projectID); $this->projectemployees = $setProjectemployees->count() == 0 ? TRUE : FALSE; } private function setReservations( ) { $reservations = Reservation::whereProjectId($this->projectID); $this->reservations = $reservations->count() == 0 ? TRUE : FALSE; } private function setProjectcosts( ) { $projectcosts = Projectcost::whereProjectId($this->projectID); $this->projectcosts = $projectcosts->count() == 0 ? TRUE : FALSE; } private function setRemoveAllowed() { if( $this->forecast === false ) return $this->removeAllowed = FALSE; if( $this->invoices === false ) return $this->removeAllowed = FALSE; if( $this->projectemployees === false ) return $this->removeAllowed = FALSE; if( $this->reservations === false ) return $this->removeAllowed = FALSE; if( $this->projectcosts === false ) return $this->removeAllowed = FALSE; $this->removeAllowed = TRUE; } }