Conversie codeigniter 4
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 27/12/2017
|
||||
* Time: 17:45
|
||||
*/
|
||||
|
||||
class RemoveProjectemployee {
|
||||
|
||||
private $projectemployeeID;
|
||||
private $removeAllowed;
|
||||
private $projecthours;
|
||||
|
||||
public function __construct( $projectemployeeID )
|
||||
{
|
||||
$this->setProjectemployeeID( $projectemployeeID );
|
||||
|
||||
$this->handle();
|
||||
}
|
||||
|
||||
public function getRemoveAllowed()
|
||||
{
|
||||
return $this->removeAllowed;
|
||||
}
|
||||
|
||||
private function setProjectemployeeID( $projectemployeeID )
|
||||
{
|
||||
$this->projectemployeeID = $projectemployeeID;
|
||||
}
|
||||
|
||||
private function handle()
|
||||
{
|
||||
$this->setProjectHours();
|
||||
|
||||
$this->setRemoveAllowed();
|
||||
}
|
||||
|
||||
private function setProjecthours()
|
||||
{
|
||||
$projecthours = Projecthour::whereProjectemployeeId($this->projectemployeeID);
|
||||
|
||||
$this->projecthours = $projecthours->count() == 0 ?TRUE : FALSE;
|
||||
}
|
||||
|
||||
private function setRemoveAllowed()
|
||||
{
|
||||
if( $this->projecthours === false ) return $this->removeAllowed = FALSE;
|
||||
|
||||
$this->removeAllowed = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user