Exemple #1
0
 public function updateDynamics()
 {
     $latest = Record::latest($this->number)->bindPublisher();
     if ($latest === null) {
         return $this;
     }
     if ($latest->in === null) {
         $this->status = self::$statusOut;
     } else {
         $this->status = self::$statusIn;
         $this->workedInYear = $latest->in < self::$lastYear;
     }
     $this->idealReturnDate = $latest->out + self::$secondsInMonth * 4;
     $this->due = $this->idealReturnDate <= time();
     $this->record = $latest;
     return $this;
 }